/**
 * Frontend mirror of the API's permission keys.
 *
 * Sources of truth in emaapi:
 * - src/common/constants/licensing-permissions.constant.ts (backoffice duties)
 * - src/common/constants/portal-permissions.constant.ts (Level 1 portal roles)
 *
 * Keys only — grants are computed server-side and arrive on
 * `GET /profiles/me` as `permissions: string[]`. A typo here can only
 * mis-hide UI; the API enforces the real thing.
 */
export const LICENSE_PERMISSIONS = {
  CREATE_APPLICATION: "can:create:license-application",
  VIEW_OWN_APPLICATIONS: "can:View:my-license-applications",
  UPDATE_APPLICATION: "can:update:license-application",
  SUBMIT_APPLICATION: "can:submit:license-application",
  VIEW_APPLICATION_QUEUE: "can:View:license-application-queue",
  VIEW_APPLICATIONS: "can:View:license-applications",
  CLAIM_APPLICATION: "can:claim:license-application",
  REVIEW_APPLICATION: "can:review:license-application",
  EVALUATE_APPLICATION: "can:evaluate:license-application",
  REQUEST_ADJUSTMENT: "can:request-adjustment:license-application",
  APPROVE_APPLICATION: "can:approve:license-application",
  REJECT_APPLICATION: "can:reject:license-application",
  ASSIGN_APPLICATION: "can:assign:license-application",
  HOLD_APPLICATION: "can:hold:license-application",
  ESCALATE_APPLICATION: "can:escalate:license-application",
  REVIEW_DOCUMENTS: "can:review:license-application-documents",
  CREATE_INSPECTION: "can:create:inspection",
  UPDATE_INSPECTION: "can:update:inspection",
  VIEW_INSPECTIONS: "can:View:inspections",
  CONFIRM_PAYMENT: "can:confirm:license-payment",
  VIEW_PAYMENTS: "can:View:license-payments",
  SCHEDULE_ISSUANCE: "can:schedule:license-issuance",
  ISSUE_CERTIFICATE: "can:issue:license-certificate",
  CREATE_LICENSE_TYPE: "can:create:license-type",
  VIEW_LICENSE_TYPES: "can:View:license-types",
  UPDATE_LICENSE_TYPE: "can:update:license-type",
  DELETE_LICENSE_TYPE: "can:delete:license-type",
  CREATE_TEMPLATE: "can:create:license-template",
  VIEW_TEMPLATES: "can:View:license-templates",
  UPDATE_TEMPLATE: "can:update:license-template",
  PUBLISH_TEMPLATE: "can:publish:license-template",
  VIEW_LICENSES: "can:View:licenses",
  SUSPEND_LICENSE: "can:suspend:license",
  CANCEL_LICENSE: "can:cancel:license",
  MANAGE_SEAFARER_STATUS: "can:manage:seafarer-status",
  VIEW_SEAFARER_REGISTRY: "can:View:seafarer-registry",
  VERIFY_SEAFARER_RECORDS: "can:verify:seafarer-records",
  ENROLL_BIOMETRICS: "can:enroll:biometrics",
  VIEW_BIOMETRICS: "can:View:biometrics",
  VIEW_VESSEL_REGISTRY: "can:View:vessel-registry",
  MANAGE_VESSEL_STATUS: "can:manage:vessel-status",
  APPROVE_QUESTION: "can:approve:exam-question",
  AUTHOR_QUESTION: "can:author:exam-question",
  MANAGE_EXAMS: "can:manage:exams",
  RECORD_EXAM_ATTENDANCE: "can:record:exam-attendance",
  MANAGE_EXAM_INCIDENTS: "can:manage:exam-incidents",
  RECORD_EXAM_RESULT: "can:record:exam-result",
  MODERATE_EXAM_RESULT: "can:moderate:exam-result",
  APPROVE_EXAM_RESULT: "can:approve:exam-result",
  PUBLISH_EXAM_RESULT: "can:publish:exam-result",
  DECIDE_EXAM_APPEAL: "can:decide:exam-appeal",
} as const;

export const PORTAL_PERMISSIONS = {
  VIEW_OWN_PROFILE: "can:View:own-profile",
  EDIT_OWN_PROFILE: "can:edit:own-profile",
  RESUBMIT_APPLICATION: "can:resubmit:license-application",
  UPLOAD_DOCUMENTS: "can:upload:own-documents",
  VIEW_OWN_DOCUMENTS: "can:View:own-documents",
  REPLACE_DOCUMENTS: "can:replace:own-documents",
  INITIATE_PAYMENT: "can:initiate:own-payment",
  VIEW_OWN_PAYMENTS: "can:View:own-payments",
  VIEW_NOTIFICATIONS: "can:View:own-notifications",
  APPLY_SEAFARER_REGISTRATION: "can:apply:seafarer-registration",
  ADD_SEA_SERVICE: "can:add:own-sea-service",
  EDIT_SEA_SERVICE: "can:edit:own-sea-service",
  VIEW_OWN_SEA_SERVICE: "can:View:own-sea-service",
  UPLOAD_MEDICAL: "can:upload:own-medical-certificate",
  VIEW_OWN_MEDICAL: "can:View:own-medical-certificate",
  APPLY_SEAFARER_CERTIFICATE: "can:apply:seafarer-certificate",
  APPLY_EXAM: "can:apply:exam",
  VIEW_OWN_EXAM: "can:View:own-exam",
  VIEW_OWN_CERTIFICATES: "can:View:own-certificates",
  VIEW_OWN_BIOMETRICS: "can:View:own-biometrics",
  APPLY_VESSEL_REGISTRATION: "can:apply:vessel-registration",
  VIEW_OWN_VESSELS: "can:View:own-vessels",
  REPORT_VESSEL_INCIDENT: "can:report:own-vessel-incident",
  APPLY_LOGISTICS_LICENSE: "can:apply:logistics-license",
  VIEW_COMPANY_LICENSES: "can:View:company-licenses",
  APPLY_WAIVER: "can:apply:waiver",
  VIEW_WAIVER_LETTER: "can:View:own-waiver-letter",
} as const;
