# Error Catalog

Dokumen ini berisi daftar lengkap kontrak error yang dikembalikan backend (`apperrorsx`). Single source of truth ada pada [internal/shared/pkg/apperrorsx/codes_defs.go](../internal/shared/pkg/apperrorsx/codes_defs.go).


## Error Code Format

Format `error_code`:

```text
[HTTP_STATUS(3)][MODULE_CODE(2)][CASE_CODE(2)]
```

Contoh:

- `4010202` → status `401`, module `02` (PIN), case `02` (PIN blocked)
- `4040302` → status `404`, module `03` (HELICOPTER), case `02` (Helicopter not found)

## Module Code

| Code | Module | Konstanta |
|---:|---|---|
| `00` | General | `ModuleGeneral` |
| `01` | Auth | `ModuleAuth` |
| `02` | PIN | `ModulePIN` |
| `03` | Helicopter | `ModuleHelicopter` |
| `04` | User | `ModuleUser` |
| `05` | Master Data | `ModuleMasterData` |
| `06` | Duty Roster | `ModuleDutyRoster` |
| `07` | Flight | `ModuleFlight` |
| `08` | Contact | `ModuleContact` |
| `09` | HEMS / Mission Operations | `ModuleMissionOps` |
| `10` | Facility | `ModuleFacility` |
| `11` | No ICAO Code | `ModuleHospital` |
| `12` | Federal State | `ModuleFederalState` |
| `13` | Nationality | `ModuleNationality` |
| `14` | ICAO | `ModuleICAO` |
| `15` | Country | `ModuleLand` |
| `16` | Base | `ModuleBase` |
| `17` | Health Insurance Companies | `ModuleHealthInsuranceCompanies` |
| `18` | Vocation | `ModuleVocation` |
| `19` | Medicine | `ModuleMedicine` |
| `20` | Master Settings | `ModuleMasterSettings` |
| `21` | File Manager | `ModuleFileManager` |
| `22` | OPC Data | `ModuleOPCData` |
| `23` | Patient Data | `ModulePatientData` |
| `24` | Insurance Patient Data | `ModuleInsurancePatientData` |
| `25` | Role | `ModuleRole` |
| `26` | Flight Data | `ModuleFlightData` |
| `27` | Air Rescuer Checklist | `ModuleAirRescuerChecklist` |
| `28` | Branding | `ModuleBranding` |
| `29` | DUL | `ModuleDUL` |
| `37` | After Flight Inspection | `ModuleAfterFlightInspection` |
| `30` | Takeover | `ModuleTakeover` |
| `31` | Fleet Status | `ModuleFleetStatus` |

## Catalog

### General (Module `00`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `INVALID_REQUEST` | `4000001` | 400 | Bad Request | invalid request |
| `DATA_NOT_FOUND` | `4040002` | 404 | Not found | data not found |
| `VALIDATION_ERROR` | `4220003` | 422 | Validation error | validation error |
| `BUSINESS_RULE_FAILED` | `4220004` | 422 | Business rule failed | business rule validation failed |
| `INTERNAL_SERVER_ERROR` | `5000005` | 500 | Internal server error | internal server error |

### Auth (Module `01`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `SESSION_EXPIRED` | `4010101` | 401 | Unauthorized | session expired |
| `TOKEN_INVALID` | `4010102` | 401 | Unauthorized | token is invalid |
| `USER_UNAUTHORIZED` | `4010103` | 401 | Unauthorized | user is unauthorized |
| `FORBIDDEN_ACCESS` | `4030104` | 403 | Forbidden | forbidden access |
| `AUTH_INVALID_JSON` | `4000105` | 400 | Bad Request | invalid json |
| `AUTH_REGISTRATION_DISABLED` | `4030106` | 403 | Forbidden | registration is disabled |
| `AUTH_ROLE_NOT_FOUND` | `4000107` | 400 | Bad Request | public registration role not found |
| `AUTH_REGISTRATION_FAILED` | `4000108` | 400 | Bad Request | registration failed |
| `AUTH_INVITE_FAILED` | `4000109` | 400 | Bad Request | invite failed |
| `AUTH_SET_PASSWORD_FAILED` | `4000110` | 400 | Bad Request | set password failed |
| `AUTH_SET_PASSWORD_TOKEN_INVALID` | `4000111` | 400 | Bad Request | set password token invalid |
| `AUTH_USERNAME_ALREADY_REGISTERED` | `4000112` | 400 | Bad Request | username already registered |
| `AUTH_RESET_PASSWORD_INVALID_LINK` | `4000113` | 400 | Bad Request | reset password link invalid |
| `AUTH_RESET_PASSWORD_FAILED` | `5000114` | 500 | Internal server error | reset password failed |

### PIN (Module `02`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `PIN_INCORRECT` | `4010201` | 401 | Unauthorized | invalid security pin |
| `PIN_BLOCKED` | `4230202` | 423 | Locked | PIN has been blocked |
| `PIN_ATTEMPT_LIMIT_REACHED` | `4290203` | 429 | Too many requests | PIN attempt limit reached |
| `PIN_NOT_SET` | `4090204` | 409 | PIN not configured | security PIN is not set |
| `PIN_NOT_BLOCKED` | `4090207` | 409 | PIN not blocked | security PIN is not blocked |
| `PIN_VALIDATION_FAILED` | `4220205` | 422 | Validation error | PIN validation failed |
| `PIN_VERIFICATION_REQUIRED` | `2020206` | 202 | PIN verification required | valid PIN action token is required |

### Helicopter (Module `03`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `HELICOPTER_DUPLICATE` | `4090301` | 409 | Conflict | helicopter identifier already exists |
| `HELICOPTER_NOT_FOUND` | `4040302` | 404 | Not found | helicopter not found |
| `HELICOPTER_RELATION_DELETE_ERROR` | `4090303` | 409 | Conflict | cannot delete helicopter due to active relations |
| `HELICOPTER_INVALID_PAYLOAD` | `4220304` | 422 | Validation error | invalid helicopter payload |
| `HELICOPTER_INVALID_JSON` | `4000305` | 400 | Bad Request | invalid json payload |
| `HELICOPTER_INVALID_ID` | `4220306` | 422 | Validation error | helicopter id is invalid |
| `HELICOPTER_ID_REQUIRED` | `4220307` | 422 | Validation error | helicopter id is required |
| `HELICOPTER_ID_MISMATCH` | `4220308` | 422 | Validation error | helicopter id mismatch |
| `HELICOPTER_ATTRIBUTES_REQUIRED` | `4220309` | 422 | Validation error | at least one attribute must be provided |
| `HELICOPTER_CREATE_FAILED` | `4000310` | 400 | Bad Request | failed to create helicopter |
| `HELICOPTER_UPDATE_FAILED` | `4000311` | 400 | Bad Request | failed to update helicopter |
| `HELICOPTER_DELETE_FAILED` | `4000312` | 400 | Bad Request | failed to delete helicopter |
| `HELICOPTER_GENERATE_FAILED` | `4000313` | 400 | Bad Request | failed to generate helicopter report number |
| `HELICOPTER_LIST_FAILED` | `4000314` | 400 | Bad Request | failed to list helicopter data |
| `HELICOPTER_PIN_VERIFICATION_REQUIRED` | `2020315` | 202 | PIN verification required | valid PIN action token is required |
| `HELICOPTER_UNAUTHORIZED` | `4010316` | 401 | Unauthorized | helicopter action unauthorized |
| `HELICOPTER_INVALID_TYPE` | `4220317` | 422 | Validation error | helicopter type is invalid |
| `HELICOPTER_FILE_NOT_FOUND` | `4040318` | 404 | Not found | helicopter file not found |
| `HELICOPTER_FILE_INVALID_PAYLOAD` | `4220319` | 422 | Validation error | invalid helicopter file payload |
| `HELICOPTER_FILE_INVALID_JSON` | `4000320` | 400 | Bad Request | invalid json payload |
| `HELICOPTER_FILE_INVALID_UUID` | `4220321` | 422 | Validation error | helicopter file uuid is invalid |
| `HELICOPTER_FILE_SECTION_INVALID` | `4220322` | 422 | Validation error | section is invalid |
| `HELICOPTER_FILE_FILE_NAME_REQUIRED` | `4220323` | 422 | Validation error | file_name is required |
| `HELICOPTER_FILE_CREATE_FAILED` | `4000324` | 400 | Bad Request | failed to create helicopter file |
| `HELICOPTER_FILE_UPDATE_FAILED` | `4000325` | 400 | Bad Request | failed to update helicopter file |
| `HELICOPTER_FILE_DELETE_FAILED` | `4000326` | 400 | Bad Request | failed to delete helicopter file |
| `HELICOPTER_FILE_GET_FAILED` | `4000327` | 400 | Bad Request | failed to get helicopter file |
| `HELICOPTER_FILE_LIST_FAILED` | `4000328` | 400 | Bad Request | failed to list helicopter file data |

### User (Module `04`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `USER_NOT_FOUND` | `4040401` | 404 | Not found | user not found |
| `USER_INVALID_PAYLOAD` | `4220402` | 422 | Validation error | invalid user payload |
| `USER_INVALID_JSON` | `4000403` | 400 | Bad Request | invalid json payload |
| `USER_INVALID_UUID` | `4220404` | 422 | Validation error | user uuid is invalid |
| `USER_VALIDATION_FAILED` | `4220405` | 422 | Validation error | user validation failed |
| `USER_CREATE_FAILED` | `4000406` | 400 | Bad Request | failed to create user |
| `USER_UPDATE_FAILED` | `4000407` | 400 | Bad Request | failed to update user |
| `USER_DELETE_FAILED` | `4000408` | 400 | Bad Request | failed to delete user |
| `USER_LIST_FAILED` | `4000409` | 400 | Bad Request | failed to list users |
| `USER_TIMEZONE_INVALID` | `4220410` | 422 | Validation error | timezone is invalid |
| `USER_ROLE_IDS_INVALID` | `4220411` | 422 | Validation error | role_ids contains invalid uuid |
| `USER_ROLE_IDS_REQUIRED` | `4220412` | 422 | Validation error | role_ids must contain at least one role |
| `USER_PRIMARY_ROLE_INVALID` | `4220413` | 422 | Validation error | primary role must be included in role_ids |

### Master Data (Module `05`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `MASTER_DATA_NOT_FOUND` | `4040501` | 404 | Not found | master data not found |
| `MASTER_DATA_INVALID_PAYLOAD` | `4220502` | 422 | Validation error | invalid master data payload |
| `MASTER_DATA_INVALID_JSON` | `4000503` | 400 | Bad Request | invalid json payload |
| `MASTER_DATA_VALIDATION_FAILED` | `4220504` | 422 | Validation error | master data validation failed |
| `MASTER_DATA_CREATE_FAILED` | `4000505` | 400 | Bad Request | failed to create master data |
| `MASTER_DATA_UPDATE_FAILED` | `4000506` | 400 | Bad Request | failed to update master data |
| `MASTER_DATA_DELETE_FAILED` | `4000507` | 400 | Bad Request | failed to delete master data |
| `MASTER_DATA_LIST_FAILED` | `4000508` | 400 | Bad Request | failed to list master data |

### Duty Roster (Module `06`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `DUTY_ROSTER_NOT_FOUND` | `4040601` | 404 | Not found | duty roster not found |
| `DUTY_ROSTER_INVALID_PAYLOAD` | `4220602` | 422 | Validation error | invalid duty roster payload |
| `DUTY_ROSTER_INVALID_JSON` | `4000603` | 400 | Bad Request | invalid json payload |
| `DUTY_ROSTER_INVALID_UUID` | `4220604` | 422 | Validation error | duty roster uuid is invalid |
| `DUTY_ROSTER_VALIDATION_FAILED` | `4220605` | 422 | Validation error | duty roster validation failed |
| `DUTY_ROSTER_CONFLICT` | `4090606` | 409 | Conflict | duty roster conflict |
| `DUTY_ROSTER_CREATE_FAILED` | `4000607` | 400 | Bad Request | failed to create duty roster |
| `DUTY_ROSTER_UPDATE_FAILED` | `4000608` | 400 | Bad Request | failed to update duty roster |
| `DUTY_ROSTER_DELETE_FAILED` | `4000609` | 400 | Bad Request | failed to delete duty roster |
| `DUTY_ROSTER_LIST_FAILED` | `4000610` | 400 | Bad Request | failed to list duty roster data |
| `DUTY_ROSTER_UNAUTHORIZED` | `4010611` | 401 | Unauthorized | duty roster unauthorized |
| `DUTY_ROSTER_BASE_TYPE_INVALID` | `4220612` | 422 | Validation error | duty roster base type is invalid |
| `DUTY_ROSTER_RELATION_DELETE_ERROR` | `4090613` | 409 | Conflict | cannot delete duty roster due to active relations |

### DUL (Module `29`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `DUL_NOT_FOUND` | `4042901` | 404 | Not found | dul not found |
| `DUL_INVALID_PAYLOAD` | `4222902` | 422 | Validation error | invalid dul payload |
| `DUL_INVALID_JSON` | `4002903` | 400 | Bad Request | invalid json payload |
| `DUL_INVALID_UUID` | `4222904` | 422 | Validation error | dul uuid is invalid |
| `DUL_VALIDATION_FAILED` | `4222905` | 422 | Validation error | dul validation failed |
| `DUL_CREATE_FAILED` | `4002906` | 400 | Bad Request | failed to create dul |
| `DUL_UPDATE_FAILED` | `4002907` | 400 | Bad Request | failed to update dul |
| `DUL_DELETE_FAILED` | `4002908` | 400 | Bad Request | failed to delete dul |
| `DUL_LIST_FAILED` | `4002909` | 400 | Bad Request | failed to list dul |
| `DUL_DATE_INVALID` | `4222910` | 422 | Validation error | date must be YYYY-MM-DD |

### Takeover (Module `30`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `TAKEOVER_NOT_FOUND` | `4043001` | 404 | Not found | takeover not found |
| `TAKEOVER_INVALID_PAYLOAD` | `4223002` | 422 | Validation error | invalid takeover payload |
| `TAKEOVER_INVALID_JSON` | `4003003` | 400 | Bad Request | invalid json payload |
| `TAKEOVER_INVALID_UUID` | `4223004` | 422 | Validation error | takeover uuid is invalid |
| `TAKEOVER_ID_REQUIRED` | `4223005` | 422 | Validation error | id is required |
| `TAKEOVER_ID_MISMATCH` | `4223006` | 422 | Validation error | id does not match path uuid |
| `TAKEOVER_FILE_SECTION_INVALID` | `4223007` | 422 | Validation error | helicopter_file_id does not belong to selected helicopter/section |
| `TAKEOVER_CREATE_FAILED` | `4003007` | 400 | Bad Request | failed to create takeover |
| `TAKEOVER_UPDATE_FAILED` | `4003008` | 400 | Bad Request | failed to update takeover |
| `TAKEOVER_DELETE_FAILED` | `4003009` | 400 | Bad Request | failed to delete takeover |
| `TAKEOVER_GET_FAILED` | `4003010` | 400 | Bad Request | failed to get takeover |
| `TAKEOVER_LIST_FAILED` | `4003011` | 400 | Bad Request | failed to list takeover data |
| `TAKEOVER_HELICOPTER_IN_USE` | `4093013` | 409 | Conflict | helicopter is already booked and cannot be used |

### Fleet Status (Module `31`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FLEET_STATUS_NOT_FOUND` | `4043101` | 404 | Not found | fleet status not found |
| `FLEET_STATUS_INVALID_PAYLOAD` | `4223102` | 422 | Validation error | invalid fleet status payload |
| `FLEET_STATUS_INVALID_JSON` | `4003103` | 400 | Bad Request | invalid json payload |
| `FLEET_STATUS_INVALID_ID` | `4223104` | 422 | Validation error | fleet status id is invalid |
| `FLEET_STATUS_ID_REQUIRED` | `4223105` | 422 | Validation error | id is required |
| `FLEET_STATUS_ID_MISMATCH` | `4223106` | 422 | Validation error | id does not match path id |
| `FLEET_STATUS_HELICOPTER_REQUIRED` | `4223107` | 422 | Validation error | helicopter_id is required |
| `FLEET_STATUS_HELICOPTER_INVALID` | `4223108` | 422 | Validation error | referenced helicopter does not exist |
| `FLEET_STATUS_DUPLICATE` | `4093109` | 409 | Conflict | fleet status already exists |
| `FLEET_STATUS_RELATION_DELETE_ERROR` | `4093110` | 409 | Conflict | cannot delete fleet status due to active relations |
| `FLEET_STATUS_CREATE_FAILED` | `4003111` | 400 | Bad Request | failed to create fleet status |
| `FLEET_STATUS_UPDATE_FAILED` | `4003112` | 400 | Bad Request | failed to update fleet status |
| `FLEET_STATUS_DELETE_FAILED` | `4003113` | 400 | Bad Request | failed to delete fleet status |
| `FLEET_STATUS_LIST_FAILED` | `4003114` | 400 | Bad Request | failed to list fleet status data |
| `FLEET_STATUS_MARK_SERVICED_FAILED` | `4003115` | 400 | Bad Request | failed to mark fleet status serviced |

### Flight (Module `07`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FLIGHT_NOT_FOUND` | `4040701` | 404 | Not found | flight not found |
| `FLIGHT_INVALID_PAYLOAD` | `4220702` | 422 | Validation error | invalid flight payload |
| `FLIGHT_INVALID_JSON` | `4000703` | 400 | Bad Request | invalid json payload |
| `FLIGHT_INVALID_UUID` | `4220704` | 422 | Validation error | flight uuid is invalid |
| `FLIGHT_VALIDATION_FAILED` | `4220705` | 422 | Validation error | flight validation failed |
| `FLIGHT_CREATE_FAILED` | `4000706` | 400 | Bad Request | failed to create flight |
| `FLIGHT_GET_FAILED` | `4000707` | 400 | Bad Request | failed to get flight |
| `FLIGHT_LIST_FAILED` | `4000708` | 400 | Bad Request | failed to list flight data |
| `FLIGHT_UNAUTHORIZED` | `4010709` | 401 | Unauthorized | flight action unauthorized |
| `FLIGHT_DATE_INVALID` | `4220710` | 422 | Validation error | date must be YYYY-MM-DD |

### Contact (Module `08`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `CONTACT_NOT_FOUND` | `4040801` | 404 | Not found | contact not found |
| `CONTACT_INVALID_PAYLOAD` | `4220802` | 422 | Validation error | invalid contact payload |
| `CONTACT_INVALID_JSON` | `4000803` | 400 | Bad Request | invalid json payload |
| `CONTACT_INVALID_USER_ID` | `4220804` | 422 | Validation error | user_id is invalid uuid |
| `CONTACT_VALIDATION_FAILED` | `4220805` | 422 | Validation error | contact validation failed |
| `CONTACT_CREATE_FAILED` | `4000806` | 400 | Bad Request | failed to create contact |
| `CONTACT_GET_FAILED` | `4000807` | 400 | Bad Request | failed to get contact |
| `CONTACT_UPDATE_FAILED` | `4000808` | 400 | Bad Request | failed to update contact |
| `CONTACT_USERNAME_CONFLICT` | `4090809` | 409 | Conflict | username already exists |
| `CONTACT_DELETE_FAILED` | `4000810` | 400 | Bad Request | failed to delete contact |
| `CONTACT_UPDATE_STATUS_FAILED` | `4000811` | 400 | Bad Request | failed to update contact status |
| `CONTACT_UPDATE_ROLE_FAILED` | `4000812` | 400 | Bad Request | failed to update contact role |
| `CONTACT_UPDATE_PILOT_CATEGORY_FAILED` | `4000813` | 400 | Bad Request | failed to update contact pilot category |
| `CONTACT_UPDATE_LICENSE_FAILED` | `4000814` | 400 | Bad Request | failed to update contact license |
| `CONTACT_UPDATE_CHIEF_FLAGS_FAILED` | `4000815` | 400 | Bad Request | failed to update contact chief flags |
| `CONTACT_UPDATE_RESPONSIBLE_COMPLAINTS_FAILED` | `4000816` | 400 | Bad Request | failed to update contact responsible complaints |
| `CONTACT_BULK_UPDATE_FAILED` | `4000817` | 400 | Bad Request | failed to bulk update contacts |
| `CONTACT_LIST_FAILED` | `4000818` | 400 | Bad Request | failed to list contacts |

### HEMS Operation / Mission Ops (Module `09`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `HEMS_OPERATION_NOT_FOUND` | `4040901` | 404 | Not found | hems operation not found |
| `HEMS_OPERATION_INVALID_PAYLOAD` | `4220902` | 422 | Validation error | invalid hems operation payload |
| `HEMS_OPERATION_INVALID_JSON` | `4000903` | 400 | Bad Request | invalid json payload |
| `HEMS_OPERATION_INVALID_UUID` | `4220904` | 422 | Validation error | hems operation uuid is invalid |
| `HEMS_OPERATION_ATTRIBUTES_REQUIRED` | `4220905` | 422 | Validation error | at least one hems operation attribute must be provided |
| `HEMS_OPERATION_DATE_INVALID_RFC3339` | `4220906` | 422 | Validation error | date must be in RFC3339 format |
| `HEMS_OPERATION_RELATION_REFERENCE_INVALID` | `4220907` | 422 | Validation error | relation reference is invalid |
| `HEMS_OPERATION_CREATE_FAILED` | `4000908` | 400 | Bad Request | failed to create hems operation |
| `HEMS_OPERATION_UPDATE_FAILED` | `4000909` | 400 | Bad Request | failed to update hems operation |
| `HEMS_OPERATION_DELETE_FAILED` | `4000910` | 400 | Bad Request | failed to delete hems operation |
| `HEMS_OPERATION_LIST_FAILED` | `4000911` | 400 | Bad Request | failed to list hems operation |

### Forces Present (Module `09`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FORCES_PRESENT_NOT_FOUND` | `4040912` | 404 | Not found | forces present not found |
| `FORCES_PRESENT_RELATION_DELETE_ERROR` | `4090913` | 409 | Conflict | cannot delete forces present due to active relations |
| `FORCES_PRESENT_INVALID_PAYLOAD` | `4220914` | 422 | Validation error | invalid forces present payload |
| `FORCES_PRESENT_INVALID_JSON` | `4000915` | 400 | Bad Request | invalid json payload |
| `FORCES_PRESENT_INVALID_UUID` | `4220916` | 422 | Validation error | forces present uuid is invalid |
| `FORCES_PRESENT_ID_REQUIRED` | `4220917` | 422 | Validation error | forces present id is required |
| `FORCES_PRESENT_ID_MISMATCH` | `4220918` | 422 | Validation error | forces present id mismatch |
| `FORCES_PRESENT_ATTRIBUTES_REQUIRED` | `4220919` | 422 | Validation error | at least one forces present attribute must be provided |
| `FORCES_PRESENT_NAME_REQUIRED` | `4220920` | 422 | Validation error | forces present name is required |
| `FORCES_PRESENT_CREATE_FAILED` | `4000921` | 400 | Bad Request | failed to create forces present |
| `FORCES_PRESENT_UPDATE_FAILED` | `4000922` | 400 | Bad Request | failed to update forces present |
| `FORCES_PRESENT_DELETE_FAILED` | `4000923` | 400 | Bad Request | failed to delete forces present |
| `FORCES_PRESENT_LIST_FAILED` | `4000924` | 400 | Bad Request | failed to list forces present data |

### Mission (Module `09`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `MISSION_NOT_FOUND` | `4040925` | 404 | Not found | mission not found |
| `MISSION_INVALID_PAYLOAD` | `4220926` | 422 | Validation error | invalid mission payload |
| `MISSION_INVALID_JSON` | `4000927` | 400 | Bad Request | invalid json payload |
| `MISSION_INVALID_FLIGHT_UUID` | `4220928` | 422 | Validation error | flight uuid is invalid |
| `MISSION_FLIGHT_ID_REQUIRED` | `4220929` | 422 | Validation error | flight_id is required |
| `MISSION_MISSION_ID_REQUIRED` | `4220930` | 422 | Validation error | mission_id is required |
| `MISSION_TYPE_INVALID` | `4220931` | 422 | Validation error | mission type is invalid |
| `MISSION_SUBTYPE_REQUIRED` | `4220932` | 422 | Validation error | subtype_id is required |
| `MISSION_SUBTYPE_INVALID` | `4220933` | 422 | Validation error | subtype_id is invalid |
| `MISSION_SUBTYPE_FORBIDDEN` | `4220934` | 422 | Validation error | subtype_id is forbidden |
| `MISSION_DUPLICATE_FLIGHT` | `4090935` | 409 | Conflict | mission for this flight already exists |
| `MISSION_CREATE_FAILED` | `4000936` | 400 | Bad Request | failed to create mission |
| `MISSION_UPDATE_FAILED` | `4000937` | 400 | Bad Request | failed to update mission |
| `MISSION_DELETE_FAILED` | `4000938` | 400 | Bad Request | failed to delete mission |
| `MISSION_GET_FAILED` | `4000939` | 400 | Bad Request | failed to get mission |
| `MISSION_INVALID_MISSION_UUID` | `4220940` | 422 | Validation error | mission uuid is invalid |
| `MISSION_LIST_FAILED` | `4000941` | 400 | Bad Request | failed to list mission data |
| `MISSION_AFTER_FLIGHT_LOCKED` | `4230942` | 423 | Locked | mission is locked because after flight inspection already exists |

### Facility (Module `10`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FACILITY_NOT_FOUND` | `4041001` | 404 | Not found | facility not found |
| `FACILITY_RELATION_DELETE_ERROR` | `4091002` | 409 | Conflict | cannot delete facility due to active relations |
| `FACILITY_INVALID_PAYLOAD` | `4221003` | 422 | Validation error | invalid facility payload |
| `FACILITY_INVALID_JSON` | `4001004` | 400 | Bad Request | invalid json payload |
| `FACILITY_INVALID_UUID` | `4221005` | 422 | Validation error | facility uuid is invalid |
| `FACILITY_ATTRIBUTES_REQUIRED` | `4221006` | 422 | Validation error | at least one facility attribute must be provided |
| `FACILITY_CATEGORY_REQUIRED` | `4221007` | 422 | Validation error | facility category is required |
| `FACILITY_NAME_REQUIRED` | `4221008` | 422 | Validation error | facility name is required |
| `FACILITY_TYPE_REQUIRED` | `4221009` | 422 | Validation error | facility type is required |
| `FACILITY_CREATE_FAILED` | `4001010` | 400 | Bad Request | failed to create facility |
| `FACILITY_UPDATE_FAILED` | `4001011` | 400 | Bad Request | failed to update facility |
| `FACILITY_DELETE_FAILED` | `4001012` | 400 | Bad Request | failed to delete facility |
| `FACILITY_LIST_FAILED` | `4001013` | 400 | Bad Request | failed to list facility data |

### No ICAO Code (Module `11`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `NO_ICAO_CODE_NOT_FOUND` | `4041101` | 404 | Not found | no icao code not found |
| `NO_ICAO_CODE_RELATION_DELETE_ERROR` | `4091102` | 409 | Conflict | cannot delete no icao code due to active relations |
| `NO_ICAO_CODE_INVALID_PAYLOAD` | `4221103` | 422 | Validation error | invalid no icao code payload |
| `NO_ICAO_CODE_INVALID_JSON` | `4001104` | 400 | Bad Request | invalid json payload |
| `NO_ICAO_CODE_INVALID_UUID` | `4221105` | 422 | Validation error | no icao code uuid is invalid |
| `NO_ICAO_CODE_ID_REQUIRED` | `4221106` | 422 | Validation error | no icao code id is required |
| `NO_ICAO_CODE_ID_MISMATCH` | `4221107` | 422 | Validation error | no icao code id mismatch |
| `NO_ICAO_CODE_ATTRIBUTES_REQUIRED` | `4221108` | 422 | Validation error | at least one no icao code attribute must be provided |
| `NO_ICAO_CODE_NAME_REQUIRED` | `4221109` | 422 | Validation error | no icao code name is required |
| `NO_ICAO_CODE_CREATE_FAILED` | `4001110` | 400 | Bad Request | failed to create no icao code |
| `NO_ICAO_CODE_UPDATE_FAILED` | `4001111` | 400 | Bad Request | failed to update no icao code |
| `NO_ICAO_CODE_DELETE_FAILED` | `4001112` | 400 | Bad Request | failed to delete no icao code |
| `NO_ICAO_CODE_LIST_FAILED` | `4001113` | 400 | Bad Request | failed to list no icao code data |

### Federal State (Module `12`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FEDERAL_STATE_NOT_FOUND` | `4041201` | 404 | Not found | federal state not found |
| `FEDERAL_STATE_RELATION_DELETE_ERROR` | `4091202` | 409 | Conflict | cannot delete federal state due to active relations |
| `FEDERAL_STATE_INVALID_PAYLOAD` | `4221203` | 422 | Validation error | invalid federal state payload |
| `FEDERAL_STATE_INVALID_JSON` | `4001204` | 400 | Bad Request | invalid json payload |
| `FEDERAL_STATE_INVALID_ID` | `4221205` | 422 | Validation error | federal state id is invalid |
| `FEDERAL_STATE_LAND_ID_INVALID` | `4221206` | 422 | Validation error | federal state land_id is invalid |
| `FEDERAL_STATE_ID_REQUIRED` | `4221207` | 422 | Validation error | federal state id is required |
| `FEDERAL_STATE_ID_MISMATCH` | `4221208` | 422 | Validation error | federal state id mismatch |
| `FEDERAL_STATE_ATTRIBUTES_REQUIRED` | `4221209` | 422 | Validation error | at least one federal state attribute must be provided |
| `FEDERAL_STATE_NAME_REQUIRED` | `4221210` | 422 | Validation error | federal state name is required |
| `FEDERAL_STATE_CREATE_FAILED` | `4001211` | 400 | Bad Request | failed to create federal state |
| `FEDERAL_STATE_UPDATE_FAILED` | `4001212` | 400 | Bad Request | failed to update federal state |
| `FEDERAL_STATE_DELETE_FAILED` | `4001213` | 400 | Bad Request | failed to delete federal state |
| `FEDERAL_STATE_LIST_FAILED` | `4001214` | 400 | Bad Request | failed to list federal state data |

### Nationality (Module `13`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `NATIONALITY_NOT_FOUND` | `4041301` | 404 | Not found | nationality not found |
| `NATIONALITY_RELATION_DELETE_ERROR` | `4091302` | 409 | Conflict | cannot delete nationality due to active relations |
| `NATIONALITY_INVALID_PAYLOAD` | `4221303` | 422 | Validation error | invalid nationality payload |
| `NATIONALITY_INVALID_JSON` | `4001304` | 400 | Bad Request | invalid json payload |
| `NATIONALITY_INVALID_UUID` | `4221305` | 422 | Validation error | nationality uuid is invalid |
| `NATIONALITY_ID_REQUIRED` | `4221306` | 422 | Validation error | nationality id is required |
| `NATIONALITY_ID_MISMATCH` | `4221307` | 422 | Validation error | nationality id mismatch |
| `NATIONALITY_ATTRIBUTES_REQUIRED` | `4221308` | 422 | Validation error | at least one nationality attribute must be provided |
| `NATIONALITY_NAME_REQUIRED` | `4221309` | 422 | Validation error | nationality name is required |
| `NATIONALITY_CREATE_FAILED` | `4001310` | 400 | Bad Request | failed to create nationality |
| `NATIONALITY_UPDATE_FAILED` | `4001311` | 400 | Bad Request | failed to update nationality |
| `NATIONALITY_DELETE_FAILED` | `4001312` | 400 | Bad Request | failed to delete nationality |
| `NATIONALITY_LIST_FAILED` | `4001313` | 400 | Bad Request | failed to list nationality data |

### ICAO (Module `14`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `ICAO_NOT_FOUND` | `4041401` | 404 | Not found | icao not found |
| `ICAO_RELATION_DELETE_ERROR` | `4091402` | 409 | Conflict | cannot delete icao due to active relations |
| `ICAO_INVALID_PAYLOAD` | `4221403` | 422 | Validation error | invalid icao payload |
| `ICAO_INVALID_JSON` | `4001404` | 400 | Bad Request | invalid json payload |
| `ICAO_INVALID_UUID` | `4221405` | 422 | Validation error | icao uuid is invalid |
| `ICAO_ID_REQUIRED` | `4221406` | 422 | Validation error | icao id is required |
| `ICAO_ID_MISMATCH` | `4221407` | 422 | Validation error | icao id mismatch |
| `ICAO_ATTRIBUTES_REQUIRED` | `4221408` | 422 | Validation error | at least one icao attribute must be provided |
| `ICAO_CODE_REQUIRED` | `4221409` | 422 | Validation error | icao code is required |
| `ICAO_LAND_ID_INVALID` | `4221410` | 422 | Validation error | icao land_id is invalid |
| `ICAO_FEDERAL_STATE_ID_INVALID` | `4221411` | 422 | Validation error | icao federal_state_id is invalid |
| `ICAO_CREATE_FAILED` | `4001412` | 400 | Bad Request | failed to create icao |
| `ICAO_UPDATE_FAILED` | `4001413` | 400 | Bad Request | failed to update icao |
| `ICAO_DELETE_FAILED` | `4001414` | 400 | Bad Request | failed to delete icao |
| `ICAO_LIST_FAILED` | `4001415` | 400 | Bad Request | failed to list icao data |

### Country (Module `15`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `COUNTRY_NOT_FOUND` | `4041501` | 404 | Not found | country not found |
| `COUNTRY_RELATION_DELETE_ERROR` | `4091502` | 409 | Conflict | cannot delete country due to active relations |
| `COUNTRY_INVALID_PAYLOAD` | `4221503` | 422 | Validation error | invalid country payload |
| `COUNTRY_INVALID_JSON` | `4001504` | 400 | Bad Request | invalid json payload |
| `COUNTRY_INVALID_ID` | `4221505` | 422 | Validation error | country id is invalid |
| `COUNTRY_ID_REQUIRED` | `4221506` | 422 | Validation error | country id is required |
| `COUNTRY_ID_MISMATCH` | `4221507` | 422 | Validation error | country id mismatch |
| `COUNTRY_ATTRIBUTES_REQUIRED` | `4221508` | 422 | Validation error | at least one country attribute must be provided |
| `COUNTRY_NAME_REQUIRED` | `4221509` | 422 | Validation error | country name is required |
| `COUNTRY_ISO_CODE_INVALID` | `4221510` | 422 | Validation error | country iso_code is invalid |
| `COUNTRY_ISO_CODE_DUPLICATE` | `4091511` | 409 | Conflict | country iso_code already exists |
| `COUNTRY_CREATE_FAILED` | `4001512` | 400 | Bad Request | failed to create country |
| `COUNTRY_UPDATE_FAILED` | `4001513` | 400 | Bad Request | failed to update country |
| `COUNTRY_DELETE_FAILED` | `4001514` | 400 | Bad Request | failed to delete country |
| `COUNTRY_LIST_FAILED` | `4001515` | 400 | Bad Request | failed to list country data |

### Base (Module `16`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `BASE_NOT_FOUND` | `4041601` | 404 | Not found | base not found |
| `BASE_DELETE_CONFLICT` | `4091615` | 409 | Conflict | cannot delete base because it is referenced by another record |
| `BASE_INVALID_PAYLOAD` | `4221603` | 422 | Validation error | invalid base payload |
| `BASE_INVALID_JSON` | `4001604` | 400 | Bad Request | invalid json payload |
| `BASE_INVALID_UUID` | `4221605` | 422 | Validation error | base uuid is invalid |
| `BASE_INVALID_CATEGORY` | `4221606` | 422 | Validation error | base category is invalid |
| `BASE_ATTRIBUTES_REQUIRED` | `4221607` | 422 | Validation error | at least one base attribute must be provided |
| `BASE_NAME_REQUIRED` | `4221608` | 422 | Validation error | base name is required |
| `BASE_DEFAULT_SHIFT_START_REQUIRED` | `4221616` | 422 | Validation error | default_shift_start is required |
| `BASE_DEFAULT_SHIFT_END_REQUIRED` | `4221617` | 422 | Validation error | default_shift_end is required |
| `BASE_CREATE_FAILED` | `4001609` | 400 | Bad Request | failed to create base |
| `BASE_UPDATE_FAILED` | `4001610` | 400 | Bad Request | failed to update base |
| `BASE_DELETE_FAILED` | `4001611` | 400 | Bad Request | failed to delete base |
| `BASE_LIST_FAILED` | `4001612` | 400 | Bad Request | failed to list base data |
| `BASE_INVALID_CONTACT_IDS` | `4221613` | 422 | Validation error | base contact ids are invalid |
| `BASE_INVALID_TIME` | `4221614` | 422 | Validation error | base time format is invalid |

Catatan:
- `BASE_DELETE_CONFLICT` mengembalikan detail relasi yang masih mengacu ke base, misalnya `takeover`, `dul`, `base operational shift times`, atau `base contact roles`.
- Detail pesan bisa berubah sesuai tabel relasi yang ditemukan saat delete.

### Health Insurance Companies (Module `17`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `HEALTH_INSURANCE_COMPANY_NOT_FOUND` | `4041701` | 404 | Not found | health insurance company not found |
| `HEALTH_INSURANCE_COMPANY_RELATION_DELETE_ERROR` | `4091702` | 409 | Conflict | cannot delete health insurance company due to active relations |
| `HEALTH_INSURANCE_COMPANY_INVALID_PAYLOAD` | `4221703` | 422 | Validation error | invalid health insurance company payload |
| `HEALTH_INSURANCE_COMPANY_INVALID_JSON` | `4001704` | 400 | Bad Request | invalid json payload |
| `HEALTH_INSURANCE_COMPANY_INVALID_UUID` | `4221705` | 422 | Validation error | health insurance company uuid is invalid |
| `HEALTH_INSURANCE_COMPANY_ID_REQUIRED` | `4221706` | 422 | Validation error | health insurance company id is required |
| `HEALTH_INSURANCE_COMPANY_ID_MISMATCH` | `4221707` | 422 | Validation error | health insurance company id mismatch |
| `HEALTH_INSURANCE_COMPANY_ATTRIBUTES_REQUIRED` | `4221708` | 422 | Validation error | at least one health insurance company attribute must be provided |
| `HEALTH_INSURANCE_COMPANY_NAME_REQUIRED` | `4221709` | 422 | Validation error | health insurance company name is required |
| `HEALTH_INSURANCE_COMPANY_LAND_ID_INVALID` | `4221710` | 422 | Validation error | health insurance company land_id is invalid |
| `HEALTH_INSURANCE_COMPANY_CREATE_FAILED` | `4001711` | 400 | Bad Request | failed to create health insurance company |
| `HEALTH_INSURANCE_COMPANY_UPDATE_FAILED` | `4001712` | 400 | Bad Request | failed to update health insurance company |
| `HEALTH_INSURANCE_COMPANY_DELETE_FAILED` | `4001713` | 400 | Bad Request | failed to delete health insurance company |
| `HEALTH_INSURANCE_COMPANY_LIST_FAILED` | `4001714` | 400 | Bad Request | failed to list health insurance company data |

### Vocation (Module `18`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `VOCATION_NOT_FOUND` | `4041801` | 404 | Not found | vocation not found |
| `VOCATION_RELATION_DELETE_ERROR` | `4091802` | 409 | Conflict | cannot delete vocation due to active relations |
| `VOCATION_INVALID_PAYLOAD` | `4221803` | 422 | Validation error | invalid vocation payload |
| `VOCATION_INVALID_JSON` | `4001804` | 400 | Bad Request | invalid json payload |
| `VOCATION_INVALID_UUID` | `4221805` | 422 | Validation error | vocation uuid is invalid |
| `VOCATION_ID_REQUIRED` | `4221806` | 422 | Validation error | vocation id is required |
| `VOCATION_ID_MISMATCH` | `4221807` | 422 | Validation error | vocation id mismatch |
| `VOCATION_ATTRIBUTES_REQUIRED` | `4221808` | 422 | Validation error | at least one vocation attribute must be provided |
| `VOCATION_NAME_REQUIRED` | `4221809` | 422 | Validation error | vocation name is required |
| `VOCATION_CREATE_FAILED` | `4001810` | 400 | Bad Request | failed to create vocation |
| `VOCATION_UPDATE_FAILED` | `4001811` | 400 | Bad Request | failed to update vocation |
| `VOCATION_DELETE_FAILED` | `4001812` | 400 | Bad Request | failed to delete vocation |
| `VOCATION_LIST_FAILED` | `4001813` | 400 | Bad Request | failed to list vocation data |

### Medicine (Module `19`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `MEDICINE_NOT_FOUND` | `4041901` | 404 | Not found | medicine not found |
| `MEDICINE_RELATION_DELETE_ERROR` | `4091902` | 409 | Conflict | cannot delete medicine due to active relations |
| `MEDICINE_INVALID_PAYLOAD` | `4221903` | 422 | Validation error | invalid medicine payload |
| `MEDICINE_INVALID_JSON` | `4001904` | 400 | Bad Request | invalid json payload |
| `MEDICINE_INVALID_UUID` | `4221905` | 422 | Validation error | medicine uuid is invalid |
| `MEDICINE_ID_REQUIRED` | `4221906` | 422 | Validation error | medicine id is required |
| `MEDICINE_ID_MISMATCH` | `4221907` | 422 | Validation error | medicine id mismatch |
| `MEDICINE_ATTRIBUTES_REQUIRED` | `4221908` | 422 | Validation error | at least one medicine attribute must be provided |
| `MEDICINE_NAME_REQUIRED` | `4221909` | 422 | Validation error | medicine name is required |
| `MEDICINE_GROUP_ID_INVALID` | `4221910` | 422 | Validation error | medicine_group_id is invalid |
| `MEDICINE_MOTOR_REACTION_ID_INVALID` | `4221911` | 422 | Validation error | motor_reaction_id is invalid |
| `MEDICINE_MOTOR_REACTION_IDS_INVALID` | `4221912` | 422 | Validation error | motor_reaction_ids contains invalid uuid |
| `MEDICINE_CREATE_FAILED` | `4001913` | 400 | Bad Request | failed to create medicine |
| `MEDICINE_UPDATE_FAILED` | `4001914` | 400 | Bad Request | failed to update medicine |
| `MEDICINE_DELETE_FAILED` | `4001915` | 400 | Bad Request | failed to delete medicine |
| `MEDICINE_LIST_FAILED` | `4001916` | 400 | Bad Request | failed to list medicine data |

### Master Settings (Module `20`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `MASTER_SETTINGS_NOT_FOUND` | `4042001` | 404 | Not found | master settings not found |
| `MASTER_SETTINGS_INVALID_PAYLOAD` | `4222002` | 422 | Validation error | invalid master settings payload |
| `MASTER_SETTINGS_INVALID_JSON` | `4002003` | 400 | Bad Request | invalid json payload |
| `MASTER_SETTINGS_INVALID_UUID` | `4222004` | 422 | Validation error | master settings uuid is invalid |
| `MASTER_SETTINGS_ID_REQUIRED` | `4222005` | 422 | Validation error | master settings id is required |
| `MASTER_SETTINGS_ID_MISMATCH` | `4222006` | 422 | Validation error | master settings id mismatch |
| `MASTER_SETTINGS_ATTRIBUTES_REQUIRED` | `4222007` | 422 | Validation error | at least one master settings attribute must be provided |
| `MASTER_SETTINGS_COMPANY_NAME_REQUIRED` | `4222008` | 422 | Validation error | company_name is required |
| `MASTER_SETTINGS_LOGO_FILE_INVALID` | `4222009` | 422 | Validation error | logo file uuid is invalid |
| `MASTER_SETTINGS_COVER_FILE_INVALID` | `4222010` | 422 | Validation error | cover file uuid is invalid |
| `MASTER_SETTINGS_CREATE_FAILED` | `4002011` | 400 | Bad Request | failed to create master settings |
| `MASTER_SETTINGS_UPDATE_FAILED` | `4002012` | 400 | Bad Request | failed to update master settings |
| `MASTER_SETTINGS_DELETE_FAILED` | `4002013` | 400 | Bad Request | failed to delete master settings |
| `MASTER_SETTINGS_GET_FAILED` | `4002014` | 400 | Bad Request | failed to get master settings |
| `MASTER_SETTINGS_MICROSOFT_ENTRA_UPSERT_FAILED` | `4002015` | 400 | Bad Request | failed to upsert microsoft entra sso settings |

### Branding (Module `28`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `BRANDING_LOGO_FETCH_FAILED` | `4002801` | 400 | Bad Request | failed to fetch branding logo |
| `BRANDING_COVER_FETCH_FAILED` | `4002802` | 400 | Bad Request | failed to fetch branding cover |
| `BRANDING_EMAIL_LOGO_FETCH_FAILED` | `4002803` | 400 | Bad Request | failed to fetch branding email logo |
| `BRANDING_CONTENT_FETCH_FAILED` | `4002804` | 400 | Bad Request | failed to fetch branding content |
| `BRANDING_STORAGE_UNAVAILABLE` | `5032805` | 503 | Internal server error | branding storage service unavailable |
| `BRANDING_FILE_MANAGER_UNAVAILABLE` | `5032806` | 503 | Internal server error | branding file manager service unavailable |

### File Manager (Module `21`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FILE_MANAGER_STORAGE_UNAVAILABLE` | `5032101` | 503 | Storage unavailable | storage service is unavailable |
| `FILE_MANAGER_QUEUE_UNAVAILABLE` | `5032102` | 503 | Queue unavailable | queue service is unavailable |
| `FILE_MANAGER_UPLOAD_INTENT_UNAVAILABLE` | `5032103` | 503 | Upload intent unavailable | upload intent service is unavailable |
| `FILE_MANAGER_ATTACHMENT_SERVICE_UNAVAILABLE` | `5032104` | 503 | Attachment service unavailable | attachment service is unavailable |
| `FILE_MANAGER_FOLDER_NOT_FOUND` | `4042105` | 404 | Not found | folder not found |
| `FILE_MANAGER_FILE_NOT_FOUND` | `4042106` | 404 | Not found | file not found |
| `FILE_MANAGER_ATTACHMENT_NOT_FOUND` | `4042107` | 404 | Not found | attachment not found |
| `FILE_MANAGER_UPLOAD_INTENT_NOT_FOUND` | `4042108` | 404 | Not found | upload intent not found |
| `FILE_MANAGER_STATUS_CONFLICT` | `4092109` | 409 | Conflict | file status conflict |
| `FILE_MANAGER_UPLOAD_INTENT_CONFLICT` | `4092110` | 409 | Conflict | upload intent conflict |
| `FILE_MANAGER_VALIDATION_FAILED` | `4222111` | 422 | Validation error | file manager validation failed |
| `FILE_MANAGER_ACTION_FAILED` | `4002112` | 400 | Bad Request | file manager action failed |

### OPC Data (Module `22`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `OPC_NOT_FOUND` | `4042201` | 404 | Not found | opc not found |
| `OPC_RELATION_DELETE_ERROR` | `4092202` | 409 | Conflict | cannot delete opc due to active relations |
| `OPC_INVALID_PAYLOAD` | `4222203` | 422 | Validation error | invalid opc payload |
| `OPC_INVALID_JSON` | `4002204` | 400 | Bad Request | invalid json payload |
| `OPC_INVALID_UUID` | `4222205` | 422 | Validation error | opc uuid is invalid |
| `OPC_ID_REQUIRED` | `4222206` | 422 | Validation error | opc id is required |
| `OPC_ID_MISMATCH` | `4222207` | 422 | Validation error | opc id mismatch |
| `OPC_ATTRIBUTES_REQUIRED` | `4222208` | 422 | Validation error | at least one opc attribute must be provided |
| `OPC_TITLE_REQUIRED` | `4222209` | 422 | Validation error | opc title is required |
| `OPC_CREATE_FAILED` | `4002210` | 400 | Bad Request | failed to create opc |
| `OPC_UPDATE_FAILED` | `4002211` | 400 | Bad Request | failed to update opc |
| `OPC_DELETE_FAILED` | `4002212` | 400 | Bad Request | failed to delete opc |
| `OPC_LIST_FAILED` | `4002213` | 400 | Bad Request | failed to list opc data |

### Patient Data (Module `23`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `PATIENT_DATA_NOT_FOUND` | `4042301` | 404 | Not found | patient data not found |
| `PATIENT_DATA_RELATION_DELETE_ERROR` | `4092302` | 409 | Conflict | cannot delete patient data due to active relations |
| `PATIENT_DATA_INVALID_PAYLOAD` | `4222303` | 422 | Validation error | invalid patient data payload |
| `PATIENT_DATA_INVALID_JSON` | `4002304` | 400 | Bad Request | invalid json payload |
| `PATIENT_DATA_INVALID_UUID` | `4222305` | 422 | Validation error | patient data uuid is invalid |
| `PATIENT_DATA_ID_REQUIRED` | `4222306` | 422 | Validation error | patient data id is required |
| `PATIENT_DATA_ID_MISMATCH` | `4222307` | 422 | Validation error | patient data id mismatch |
| `PATIENT_DATA_ATTRIBUTES_REQUIRED` | `4222308` | 422 | Validation error | at least one patient data attribute must be provided |
| `PATIENT_DATA_FAMILY_NAME_REQUIRED` | `4222309` | 422 | Validation error | family_name is required |
| `PATIENT_DATA_FIRST_NAME_REQUIRED` | `4222310` | 422 | Validation error | first_name is required |
| `PATIENT_DATA_BIRTH_DATE_INVALID` | `4222311` | 422 | Validation error | birth_date is invalid |
| `PATIENT_DATA_GENDER_INVALID` | `4222312` | 422 | Validation error | gender is invalid |
| `PATIENT_DATA_OPC_ID_INVALID` | `4222313` | 422 | Validation error | opc_id is invalid |
| `PATIENT_DATA_INSURANCE_PATIENT_DATA_ID_INVALID` | `4222314` | 422 | Validation error | insurance_patient_data_id is invalid |
| `PATIENT_DATA_CREATE_FAILED` | `4002315` | 400 | Bad Request | failed to create patient data |
| `PATIENT_DATA_UPDATE_FAILED` | `4002316` | 400 | Bad Request | failed to update patient data |
| `PATIENT_DATA_DELETE_FAILED` | `4002317` | 400 | Bad Request | failed to delete patient data |
| `PATIENT_DATA_LIST_FAILED` | `4002318` | 400 | Bad Request | failed to list patient data |

### Insurance Patient Data (Module `24`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `INSURANCE_PATIENT_DATA_NOT_FOUND` | `4042401` | 404 | Not found | insurance patient data not found |
| `INSURANCE_PATIENT_DATA_RELATION_DELETE_ERROR` | `4092402` | 409 | Conflict | cannot delete insurance patient data due to active relations |
| `INSURANCE_PATIENT_DATA_INVALID_PAYLOAD` | `4222403` | 422 | Validation error | invalid insurance patient data payload |
| `INSURANCE_PATIENT_DATA_INVALID_JSON` | `4002404` | 400 | Bad Request | invalid json payload |
| `INSURANCE_PATIENT_DATA_INVALID_UUID` | `4222405` | 422 | Validation error | insurance patient data uuid is invalid |
| `INSURANCE_PATIENT_DATA_ID_REQUIRED` | `4222406` | 422 | Validation error | insurance patient data id is required |
| `INSURANCE_PATIENT_DATA_ID_MISMATCH` | `4222407` | 422 | Validation error | insurance patient data id mismatch |
| `INSURANCE_PATIENT_DATA_ATTRIBUTES_REQUIRED` | `4222408` | 422 | Validation error | at least one insurance patient data attribute must be provided |
| `INSURANCE_PATIENT_DATA_HEALTH_INSURANCE_ID_INVALID` | `4222409` | 422 | Validation error | health_insurance_companies_id is invalid |
| `INSURANCE_PATIENT_DATA_FEDERAL_STATE_ID_INVALID` | `4222410` | 422 | Validation error | federal_state_id is invalid |
| `INSURANCE_PATIENT_DATA_CREATE_FAILED` | `4002411` | 400 | Bad Request | failed to create insurance patient data |
| `INSURANCE_PATIENT_DATA_UPDATE_FAILED` | `4002412` | 400 | Bad Request | failed to update insurance patient data |
| `INSURANCE_PATIENT_DATA_DELETE_FAILED` | `4002413` | 400 | Bad Request | failed to delete insurance patient data |
| `INSURANCE_PATIENT_DATA_LIST_FAILED` | `4002414` | 400 | Bad Request | failed to list insurance patient data |

### Role (Module `25`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `ROLE_NOT_FOUND` | `4042501` | 404 | Not found | role not found |
| `ROLE_PERMISSION_NOT_FOUND` | `4042502` | 404 | Not found | permission not found |
| `ROLE_RELATION_DELETE_ERROR` | `4092503` | 409 | Conflict | cannot delete role due to active relations |
| `ROLE_INVALID_PAYLOAD` | `4222504` | 422 | Validation error | invalid role payload |
| `ROLE_INVALID_JSON` | `4002505` | 400 | Bad Request | invalid json payload |
| `ROLE_INVALID_UUID` | `4222506` | 422 | Validation error | role uuid is invalid |
| `ROLE_INVALID_PERMISSION_UUID` | `4222507` | 422 | Validation error | permission uuid is invalid |
| `ROLE_ID_REQUIRED` | `4222508` | 422 | Validation error | role id is required |
| `ROLE_ID_MISMATCH` | `4222509` | 422 | Validation error | role id mismatch |
| `ROLE_ATTRIBUTES_REQUIRED` | `4222510` | 422 | Validation error | at least one role attribute must be provided |
| `ROLE_NAME_REQUIRED` | `4222511` | 422 | Validation error | role name is required |
| `ROLE_PERMISSION_ID_REQUIRED` | `4222512` | 422 | Validation error | permission_id is required |
| `ROLE_PERMISSION_IDS_EMPTY` | `4222513` | 422 | Validation error | permission_ids must not be empty |
| `ROLE_CREATE_FAILED` | `4002514` | 400 | Bad Request | failed to create role |
| `ROLE_UPDATE_FAILED` | `4002515` | 400 | Bad Request | failed to update role |
| `ROLE_DELETE_FAILED` | `4002516` | 400 | Bad Request | failed to delete role |
| `ROLE_ASSIGN_FAILED` | `4002517` | 400 | Bad Request | failed to assign permission |
| `ROLE_REMOVE_FAILED` | `4002518` | 400 | Bad Request | failed to remove permission |
| `ROLE_LIST_FAILED` | `4002519` | 400 | Bad Request | failed to list role data |
| `ROLE_PERMISSION_LIST_FAILED` | `4002520` | 400 | Bad Request | failed to list permission data |
| `ROLE_PERMISSION_UPDATE_FAILED` | `4002521` | 400 | Bad Request | failed to update permission |
| `ROLE_PERMISSION_REQUIRES_PIN_REQUIRED` | `4222522` | 422 | Validation error | requires_pin is required |

### Flight Data (Module `26`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `FLIGHT_DATA_NOT_FOUND` | `4042601` | 404 | Not found | flight data not found |
| `FLIGHT_DATA_INVALID_PAYLOAD` | `4222602` | 422 | Validation error | invalid flight data payload |
| `FLIGHT_DATA_INVALID_JSON` | `4002603` | 400 | Bad Request | invalid json payload |
| `FLIGHT_DATA_INVALID_PATH_UUID` | `4222604` | 422 | Validation error | path uuid is invalid |
| `FLIGHT_DATA_MISSION_ID_REQUIRED` | `4222605` | 422 | Validation error | mission_id is required |
| `FLIGHT_DATA_PILOT_ID_REQUIRED` | `4222606` | 422 | Validation error | pilot_id is required |
| `FLIGHT_DATA_INVALID_UUID` | `4222607` | 422 | Validation error | uuid is invalid |
| `FLIGHT_DATA_INVALID_RFC3339` | `4222608` | 422 | Validation error | datetime must be RFC3339 |
| `FLIGHT_DATA_ORIGIN_LOCATION_REFERENCE` | `4222609` | 422 | Validation error | origin location reference is invalid |
| `FLIGHT_DATA_DESTINATION_LOCATION_REFERENCE` | `4222610` | 422 | Validation error | destination location reference is invalid |
| `FLIGHT_DATA_REQUIRED` | `4002611` | 400 | Bad Request | required flight data is missing |
| `FLIGHT_DATA_CREATE_FAILED` | `4002612` | 400 | Bad Request | failed to create flight data |
| `FLIGHT_DATA_GET_FAILED` | `4002613` | 400 | Bad Request | failed to get flight data |
| `FLIGHT_DATA_AFTER_FLIGHT_INCOMPLETE` | `4222616` | 422 | Validation error | cannot submit after-flight: flight data is incomplete |
| `FLIGHT_DATA_CREATE_BLOCKED` | `4092618` | 409 | Conflict | flight data cannot be created because fm report already exists for this flight |
| `FLIGHT_DATA_AFTER_FLIGHT_LOCKED` | `4232618` | 423 | Locked | flight data is locked because after flight inspection already exists |
| `FLIGHT_DATA_LOCKED` | `4232619` | 423 | Locked | flight data is locked because fm report is completed |

### Air Rescuer Checklist (Module `27`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `AIR_RESCUER_CHECKLIST_NOT_FOUND` | `4042701` | 404 | Not found | air rescuer checklist not found |
| `AIR_RESCUER_CHECKLIST_ITEM_NOT_FOUND` | `4042702` | 404 | Not found | air rescuer checklist item not found |
| `AIR_RESCUER_CHECKLIST_INVALID_PAYLOAD` | `4222703` | 422 | Validation error | invalid air rescuer checklist payload |
| `AIR_RESCUER_CHECKLIST_INVALID_JSON` | `4002704` | 400 | Bad Request | invalid json payload |
| `AIR_RESCUER_CHECKLIST_INVALID_UUID` | `4222705` | 422 | Validation error | air rescuer checklist uuid is invalid |
| `AIR_RESCUER_CHECKLIST_ID_MISMATCH` | `4222706` | 422 | Validation error | id does not match path uuid |
| `AIR_RESCUER_CHECKLIST_SCOPE_INVALID` | `4222707` | 422 | Validation error | scope_code is invalid |
| `AIR_RESCUER_CHECKLIST_SCOPE_REQUIRED` | `4222708` | 422 | Validation error | scope_code is required |
| `AIR_RESCUER_CHECKLIST_TITLE_REQUIRED` | `4222709` | 422 | Validation error | title is required |
| `AIR_RESCUER_CHECKLIST_NAME_REQUIRED` | `4222710` | 422 | Validation error | name is required |
| `AIR_RESCUER_CHECKLIST_BASE_NOT_FOUND` | `4042711` | 404 | Not found | base not found |
| `AIR_RESCUER_CHECKLIST_CREATE_FAILED` | `4002712` | 400 | Bad Request | failed to create air rescuer checklist |
| `AIR_RESCUER_CHECKLIST_UPDATE_FAILED` | `4002713` | 400 | Bad Request | failed to update air rescuer checklist |
| `AIR_RESCUER_CHECKLIST_DELETE_FAILED` | `4002714` | 400 | Bad Request | failed to delete air rescuer checklist |
| `AIR_RESCUER_CHECKLIST_LIST_FAILED` | `4002715` | 400 | Bad Request | failed to list air rescuer checklist |
| `AIR_RESCUER_CHECKLIST_REORDER_FAILED` | `4002716` | 400 | Bad Request | failed to reorder air rescuer checklist items |
| `AIR_RESCUER_CHECKLIST_VALIDATION_FAILED` | `4222717` | 422 | Validation error | air rescuer checklist validation failed |

### After Flight Inspection (Module `37`)

| Code | Error Code | HTTP | Title | Message |
|---|---:|---:|---|---|
| `AFTER_FLIGHT_INVALID_ID` | `4223701` | 422 | Validation error | flight_inspection_id is invalid |
| `AFTER_FLIGHT_FLIGHT_INSPECTION_NOT_FOUND` | `4043702` | 404 | Not found | flight inspection not found |
| `AFTER_FLIGHT_INSPECTION_NOT_FOUND` | `4043703` | 404 | Not found | after flight inspection not found |
| `AFTER_FLIGHT_CAPABILITIES_UNAVAILABLE` | `4223704` | 422 | Validation error | helicopter capabilities could not be resolved |
| `AFTER_FLIGHT_NR1_REQUIRED` | `4223705` | 422 | Validation error | oil_engine_nr1_checked is required for this helicopter |
| `AFTER_FLIGHT_NR1_NOT_AVAILABLE` | `4223706` | 422 | Validation error | NR1 capability not available on this helicopter |
| `AFTER_FLIGHT_NR2_REQUIRED` | `4223707` | 422 | Validation error | oil_engine_nr2_checked is required for this helicopter |
| `AFTER_FLIGHT_NR2_NOT_AVAILABLE` | `4223708` | 422 | Validation error | NR2 capability not available on this helicopter |
| `AFTER_FLIGHT_LH_REQUIRED` | `4223709` | 422 | Validation error | hydraulic_lh_checked is required for this helicopter |
| `AFTER_FLIGHT_LH_NOT_AVAILABLE` | `4223710` | 422 | Validation error | LH capability not available on this helicopter |
| `AFTER_FLIGHT_RH_REQUIRED` | `4223711` | 422 | Validation error | hydraulic_rh_checked is required for this helicopter |
| `AFTER_FLIGHT_RH_NOT_AVAILABLE` | `4223712` | 422 | Validation error | RH capability not available on this helicopter |
| `AFTER_FLIGHT_MGB_REQUIRED` | `4223713` | 422 | Validation error | oil_transmission_mgb_checked is required for this helicopter |
| `AFTER_FLIGHT_MGB_NOT_AVAILABLE` | `4223714` | 422 | Validation error | MGB capability not available on this helicopter |
| `AFTER_FLIGHT_IGB_REQUIRED` | `4223715` | 422 | Validation error | oil_transmission_igb_checked is required for this helicopter |
| `AFTER_FLIGHT_IGB_NOT_AVAILABLE` | `4223716` | 422 | Validation error | IGB capability not available on this helicopter |
| `AFTER_FLIGHT_TGB_REQUIRED` | `4223717` | 422 | Validation error | oil_transmission_tgb_checked is required for this helicopter |
| `AFTER_FLIGHT_TGB_NOT_AVAILABLE` | `4223718` | 422 | Validation error | TGB capability not available on this helicopter |
| `AFTER_FLIGHT_INVALID_JSON` | `4003719` | 400 | Bad Request | invalid json payload |

## Notes

- `title` dan `detail` dapat berubah mengikuti copywriting; jangan dijadikan kontrak parsing.
- `code` dan `error_code` harus dianggap stabil sebagai kontrak integrasi BE↔FE.
- Uniqueness `code` dan `error_code` divalidasi lewat test registry di package [apperrorsx](../internal/shared/pkg/apperrorsx) (`registry_test.go`).
- Sumber definisi tunggal: [codes_defs.go](../internal/shared/pkg/apperrorsx/codes_defs.go) (konstanta `Code*`, `Case*`, dan variable `Err*` + `Registry`).
- Jika menambah error baru: daftarkan di `codes_defs.go` (konstanta + variable `Err*`) lalu masukkan ke `Registry`, kemudian update tabel di catalog ini.
