class ClientIllnessesController {

    @DeleteMapping("/clients/{uid}/illnesses/{id}")
    public ResponseEntity<IllnessRecord> deleteIllness(
            @PathVariable int uid,
            @PathVariable int id,
            @RequestHeader(value = "X-Auth-Token", required = false) String authToken) throws InvalidRequestException {
        Optional<Client> optionalClient = State.getClientManager().getClientByID(uid);
        if (!optionalClient.isPresent()) {
            //Return 404 if that client does not exist
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
        Client client = optionalClient.get();

        IllnessRecord removeRecord = client.getIllnessById(id);
        if (removeRecord == null) {
            //Return 404 if that illness does not exist
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }

        State.getAuthenticationManager().verifyClientAccess(authToken, client);
        DeleteIllnessRecordAction action = new DeleteIllnessRecordAction(client, removeRecord,
                State.getClientManager());
        State.getActionInvoker(authToken).execute(action);

        Client client1 = State.getClientManager()
                .getClientByID(client.getUid())
                .orElseThrow(IllegalStateException::new);

        HttpHeaders headers = new HttpHeaders();

        return new ResponseEntity<>(removeRecord, headers, HttpStatus.OK);

    }

}