# Controller Design — Unit 03: Availability Module Dit document beschrijft de endpoints van de `AvailabilityController`. ## 1. Publieke Status Endpoint - **Method**: `GET` - **Path**: `/api/availability/status` - **Auth**: Geen (AllowAnonymous) - **Response**: `AvailabilityResponse` - **Logic**: Roept `IAvailabilityService.IsAvailableAsync()` aan en mapt de status naar het response object. ## 2. Status Update Endpoint (Beheer) - **Method**: `POST` - **Path**: `/api/availability/admin/status` - **Auth**: `OwnerOnly` Policy (Unit 02) - **Request Body**: ```json { "newStatus": "Maintenance", "reason": "Gepland database onderhoud" } ``` - **Logic**: 1. Valideert de nieuwe status. 2. Werkt de database record bij via de `IAvailabilityService`. 3. Maakt een audit log aan (Unit 02). - **Response**: `200 OK`. ## 3. Integratie met Audit Log Bij elke statuswijziging wordt de `IAuditService` aangeroepen met de volgende gegevens: - **ActorId**: De ID van de Owner. - **Action**: `SystemStatusChanged`. - **Details**: `OldStatus: Available, NewStatus: Maintenance, Reason: ...`