# Business Logic Model — Unit 03: Availability Module Dit document beschrijft de processen voor beschikbaarheidscontrole. ## 1. Availability Middleware Flow ```mermaid graph TD A[Inkomend Request] --> B{Is Endpoint /status?} B -- Ja --> C[Laat door naar Controller] B -- Nee --> D{Check Status via IAvailabilityService} D --> E{Status == Available?} E -- Ja --> C E -- Nee --> F{Status == Maintenance?} F -- Ja --> G{Heeft Rol Admin/Owner?} G -- Ja --> C G -- Nee --> H[Retourneer 503 + ApiErrorResponse] F -- Nee --> H ``` ## 2. Status Check Flow 1. **Client** roept `GET /api/availability/status` aan. 2. **AvailabilityController** roept `IAvailabilityService.IsAvailableAsync()` aan. 3. **Service** haalt status op (in MVP uit config of in-memory state). 4. **Controller** bouwt response: ```json { "status": "Available", "checkedAt": "2026-06-12T01:15:00Z", "message": "System is running normally." } ``` ## 3. Remote Shutdown Logic (Toekomst) Hoewel de MVP een stub gebruikt, is het logic model voorbereid op een externe trigger: - Een administratieve actie zet een vlag in de database/cache. - De `IAvailabilityService` detecteert deze wijziging. - De Middleware reageert direct op alle volgende requests.