export const URL_CONSTANTS = {
  AUTH: {
    LOGIN: "/auth/login",
    REGISTER: "/auth/register",
    REFRESH_TOKEN: "/auth/refresh-token",
    LOGOUT: "/auth/logout",
    PROFILE: "/auth/profile",
  },

  USERS: {
    SIGN_UP: "/api/auth/signup",
    GENERATE_VERIFICATION_CODE: "/api/auth/generate-verification-code",
    BASE: "/users",
    BY_ID: (id: string | number) => `/users/${id}`,
    SET_PASSWORD: "/api/auth/set-password",
    ME: "/api/auth/me",
  },

  ROLES: {
    BASE: "/roles",
    BY_ID: (id: string | number) => `/roles/${id}`,
  },

  PERMISSIONS: {
    BASE: "/permissions",
    BY_ID: (id: string | number) => `/permissions/${id}`,
  },

  PRODUCTS: {
    BASE: "/products",
    BY_ID: (id: string | number) => `/products/${id}`,
  },

  ORDERS: {
    BASE: "/orders",
    BY_ID: (id: string | number) => `/orders/${id}`,
  },

  FILES: {
    BASE: "/files",
    UPLOAD: "/files/upload",
    FILE_UPLOAD_SETTINGS: "/files/upload",
    FILE_UPLOAD_SETTINGS_BY_CODE: "/file-upload-settings/by-code",
    DOWNLOAD: (id: string | number) => `/files/${id}/download`,
    DELETE: (id: string | number) => `/files/${id}`,
    BY_ID: (id: string | number) => `/files/${id}`,
  },

  SETTINGS: {
    BASE: "/settings",
    GENERAL: "/settings/general",
    SECURITY: "/settings/security",
    NOTIFICATIONS: "/settings/notifications",
  },

  DROPDOWN_SETTINGS: {
    BASE: "/dropdown-settings",
    BY_ID: (id: string) => `/api/dropdown-settings/${id}`,
    BY_CODE: (code: string) =>
      `/dropdown-settings/by-code/${encodeURIComponent(code)}`,
    OPTIONS: (id: string) => `/dropdown-settings/${id}/options`,
    OPTION_BY_ID: (optionId: string) =>
      `/api/dropdown-settings/options/${optionId}`,
  },

  CUSTOMERS: {
    BASE: "/customers",
    BY_ID: (id: string | number) => `/customers/${id}`,
    BOOKINGS: (id: string | number) => `/customers/${id}/bookings`,
  },

  COMPANIES: {
    BASE: "/companies",
    STATS: "/companies/stats",
    BY_ID: (id: string | number) => `/companies/${id}`,
    DOCUMENTS: (id: string) => `/companies/${id}/documents`,
    PROFILE_STATUS: (profileId: string) =>
      `/companies/company-profiles/${profileId}/status`,
    CHANGE_REQUESTS: (companyId: string) =>
      `/companies/${companyId}/change-requests`,
    CHANGE_REQUEST_APPROVE: (id: string) =>
      `/companies/change-requests/${id}/approve`,
    CHANGE_REQUEST_REJECT: (id: string) =>
      `/companies/change-requests/${id}/reject`,
    DOCUMENT_REQUEST_CHANGE: (fileId: string) =>
      `/companies/documents/${fileId}/request-change`,
    BOOKINGS_CUSTOMER_VIEW: (id: string) =>
      `/bookings/by-company/${id}/customer-view`,
    PAYMENTS_CUSTOMER_VIEW: (id: string) =>
      `/payments/by-company/${id}/customer-view`,
    RESET_PASSWORD: (companyId: string) =>
      `/backoffice/customers/${companyId}/reset-password`,
    RESET_TARGET: (companyId: string) =>
      `/backoffice/customers/${companyId}/reset-target`,
  },

  BILLING: {
    INVOICES: "/billing/invoices",
    INVOICE_BY_ID: (id: string) => `/billing/invoices/${id}`,
    INVOICE_DOCUMENT: (id: string) => `/billing/invoices/${id}/document`,
  },

  CUSTOMERS_API: {
    BASE: "/api/customers",
    BY_ID: (id: string) => `/api/customers/${id}`,
    BY_USER_ID: (id: string) => `/api/customers/user/${id}`,
  },

  OVERVIEW: {
    BASE: "/overview",
    BOOKINGS: "/overview/bookings",
    CONTRACTS: "/overview/contracts",
    BILLING: "/overview/billing",
    OPERATIONS: "/overview/operations",
    CUSTOMERS: "/overview/customers",
    STAFF: "/overview/staff",
  },

  BOOKINGS: {
    BASE: "/bookings",
    REFERENCE_DATA: "/bookings/reference-data",
    LIST_SUMMARY: "/bookings/list-summary",
    BY_ID: (id: string) => `/bookings/${id}`,
    QUEUE: (queue: string) => `/bookings/queues/${queue}`,
    STAFF_ACCEPT: (id: string) => `/bookings/${id}/staff/accept`,
    STAFF_REQUEST_CHANGES: (id: string) =>
      `/bookings/${id}/staff/request-changes`,
    STAFF_REJECT: (id: string) => `/bookings/${id}/staff/reject`,
    GOVERNMENT_EXPEDITE: (id: string) => `/bookings/${id}/government-expedite`,
    CONTRACT_GENERATE: (id: string) => `/bookings/${id}/contract/generate`,
    CONTRACT_VIEW: (id: string) => `/bookings/${id}/contract/view`,
    CONTRACT_DOCUMENT: (id: string) => `/bookings/${id}/contract/document`,
    CONTRACT_SIGN: (id: string) => `/bookings/${id}/contract/sign`,
    CONTRACT_DOWNLOAD: (id: string) => `/bookings/${id}/contract`,
    SUMMARY: (id: string) => `/bookings/${id}/summary`,
    CUSTOMER_SIGN: (id: string) => `/bookings/${id}/customer/sign`,
    MARKETING_APPROVE: (id: string) => `/bookings/${id}/marketing/approve`,
    PAYMENT_PAY: (id: string) => `/bookings/${id}/payment/pay`,
    START_TRANSIT: (id: string) => `/bookings/${id}/operations/start-transit`,
    COMPLETE: (id: string) => `/bookings/${id}/operations/complete`,
    CANCEL: (id: string) => `/bookings/${id}/cancel`,
    CONSOLIDATION: (id: string) => `/bookings/${id}/consolidation`,
    CLEARANCE: (id: string) => `/bookings/${id}/clearance`,
    CLEARANCE_DECLARATION: (id: string) =>
      `/bookings/${id}/clearance/declaration`,
    CLEARANCE_DUTY: (id: string) => `/bookings/${id}/clearance/duty`,
    CLEARANCE_FINALIZE_PRE: (id: string) =>
      `/bookings/${id}/clearance/finalize-pre-clearance`,
    CLEARANCE_TRANSIT_PERMIT: (id: string) =>
      `/bookings/${id}/clearance/transit-permit`,
    CLEARANCE_DELIVERY_ORDER: (id: string) =>
      `/bookings/${id}/clearance/delivery-order`,
    CLEARANCE_RELEASE_ORDER: (id: string) =>
      `/bookings/${id}/clearance/release-order`,
    CLEARANCE_RO_AMENDMENT: (id: string) =>
      `/bookings/${id}/clearance/ro-amendment`,
    CLEARANCE_EXPORT_RELEASE: (id: string) =>
      `/bookings/${id}/clearance/export-release`,
    // Re-request operation after Operations sent the booking back for changes.
    CLEARANCE_PROCEED: (id: string) => `/bookings/${id}/clearance/proceed`,
    CLEARANCE_ET_QUEUE: "/bookings/clearance/et-queue",
    CLEARANCE_DJ_QUEUE: "/bookings/clearance/dj-queue",
  },

  CONTRACTS: {
    BASE: "/contracts",
    LIST_SUMMARY: "/contracts/list-summary",
    BY_ID: (id: string) => `/contracts/${id}`,
    STAFF_ACCEPT: (id: string) => `/contracts/${id}/staff/accept`,
    STAFF_REQUEST_CHANGES: (id: string) =>
      `/contracts/${id}/staff/request-changes`,
    STAFF_REJECT: (id: string) => `/contracts/${id}/staff/reject`,
    APPROVE_STEP: (id: string, stepId: string) =>
      `/contracts/${id}/approval-steps/${stepId}/approve`,
    REJECT_STEP: (id: string, stepId: string) =>
      `/contracts/${id}/approval-steps/${stepId}/reject`,
    CONTRACT_GENERATE: (id: string) => `/contracts/${id}/contract/generate`,
    CONTRACT_VIEW: (id: string) => `/contracts/${id}/contract/view`,
    CONTRACT_DOCUMENT: (id: string) => `/contracts/${id}/contract/document`,
    CONTRACT_SIGN: (id: string) => `/contracts/${id}/contract/sign`,
    CONTRACT_DOCUMENT_DRAFT: (id: string) => `/contracts/${id}/document/draft`,
    CONTRACT_DOCUMENT_REVISIONS: (id: string) =>
      `/contracts/${id}/document/revisions`,
    CONTRACT_DOCUMENT_ARTICLES: (id: string) =>
      `/contracts/${id}/document/articles`,
    CLEARANCE_QUEUE: "/contracts/clearance/queue",
    CLEARANCE: (id: string) => `/contracts/${id}/clearance`,
    CLEARANCE_REVIEW: (id: string) => `/contracts/${id}/clearance/review`,
    /** Pre-declaration transit-assignee handshake (ET asks, DJ answers). */
    CLEARANCE_TRANSIT_ASSIGNEE_REQUEST: (id: string) =>
      `/contracts/${id}/clearance/transit-assignee/request`,
    CLEARANCE_TRANSIT_ASSIGNEE_ASSIGN: (id: string) =>
      `/contracts/${id}/clearance/transit-assignee/assign`,
    /** Staff corrects a clearance document in place; the old version is kept. */
    CLEARANCE_DOC_REPLACE: (id: string, fileKey: string) =>
      `/contracts/${id}/clearance/documents/${encodeURIComponent(fileKey)}/replace`,
    CLEARANCE_DOC_VERSIONS: (id: string, fileKey: string) =>
      `/contracts/${id}/clearance/documents/${encodeURIComponent(fileKey)}/versions`,
    CLEARANCE_OUTPUT_DOCUMENTS: (id: string) =>
      `/contracts/${id}/clearance/output-documents`,
    CLEARANCE_FINALIZE: (id: string) => `/contracts/${id}/clearance/finalize`,
    CLEARANCE_DECLARATION: (id: string) =>
      `/contracts/${id}/clearance/declaration`,
    CLEARANCE_DUTY: (id: string) => `/contracts/${id}/clearance/duty`,
    CLEARANCE_DUTY_SLIP: (id: string) => `/contracts/${id}/clearance/duty-slip`,
    CLEARANCE_FINALIZE_PRE: (id: string) =>
      `/contracts/${id}/clearance/finalize-pre-clearance`,
    CLEARANCE_TRANSIT_PERMIT: (id: string) =>
      `/contracts/${id}/clearance/transit-permit`,
    CLEARANCE_DELIVERY_ORDER: (id: string) =>
      `/contracts/${id}/clearance/delivery-order`,
    CLEARANCE_RELEASE_ORDER: (id: string) =>
      `/contracts/${id}/clearance/release-order`,
    CLEARANCE_RO_AMENDMENT: (id: string) =>
      `/contracts/${id}/clearance/ro-amendment`,
    CLEARANCE_EXPORT_RELEASE: (id: string) =>
      `/contracts/${id}/clearance/export-release`,
    CLEARANCE_FINALIZE_EXPORT: (id: string) =>
      `/contracts/${id}/clearance/finalize-export-clearance`,
    CLEARANCE_ET_QUEUE: "/contracts/clearance/et-queue",
    CLEARANCE_DJ_QUEUE: "/contracts/clearance/dj-queue",
    // Path A self-clearance — Operations reviews the customer's own clearance docs.
    OPS_CLEARANCE_QUEUE: "/contracts/clearance/ops-queue",
    OPS_CLEARANCE_REVIEW: (id: string) =>
      `/contracts/${id}/clearance/ops-review`,
    OPS_CLEARANCE_FINALIZE: (id: string) =>
      `/contracts/${id}/clearance/ops-finalize`,
    CLEARANCE_HISTORY: "/contracts/clearance/history",
    OPS_CLEARANCE_HISTORY: "/contracts/clearance/ops-history",
    BOOKINGS: (id: string) => `/contracts/${id}/bookings`,
    BOOKINGS_COMPLETE: (id: string, bookingId: string) =>
      `/contracts/${id}/bookings/${bookingId}/complete`,
    VALIDATE_SHIPMENT: (id: string) => `/contracts/${id}/validate-shipment`,
    CAPACITY: (id: string) => `/contracts/${id}/capacity`,
    // Shipment requests (GENERAL + customs, Path B): customer → GL queue → booking.
    BOOKING_REQUEST_QUEUE: "/contracts/booking-requests/queue",
    BOOKING_REQUEST_BY_ID: (reqId: string) =>
      `/contracts/booking-requests/${reqId}`,
    BOOKING_REQUESTS: (id: string) => `/contracts/${id}/booking-requests`,
    BOOKING_REQUEST_ACCEPT: (reqId: string) =>
      `/contracts/booking-requests/${reqId}/accept`,
    BOOKING_REQUEST_REJECT: (reqId: string) =>
      `/contracts/booking-requests/${reqId}/reject`,
    MILESTONES: (id: string) => `/contracts/${id}/milestones`,
    BOOKING_MILESTONES: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/milestones`,
    COMPLETE_BOOKING_MILESTONE: (bookingId: string, code: string) =>
      `/contracts/bookings/${bookingId}/milestones/${code}/complete`,
    // ── GL post-booking operational actions ──
    BOOKING_RISK: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/risk`,
    BOOKING_DUTY: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/duty`,
    BOOKING_STATION_ASSIGN: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/station-assign`,
    BOOKING_GL_DOCUMENTS: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/documents`,
    BOOKING_TRANSPORT_DOCUMENT: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/transport-document`,
    BOOKING_T1_DOCUMENTS: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/t1-documents`,
    BOOKING_T1_CLOSE: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/t1-close`,
    BOOKING_FINAL_INVOICE: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/final-invoice`,
    BOOKING_FINAL_INVOICE_CONFIRM: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/final-invoice/confirm`,
    BOOKING_SECOND_DUTY: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/second-duty`,
    BOOKING_INCIDENTS: (bookingId: string) =>
      `/contracts/bookings/${bookingId}/incidents`,
  },

  OTP: {
    SEND: "/api/otp/send",
    VERIFY: "/api/otp/verify",
  },

  PAYMENTS: {
    ALL: "/payments/all",
    SUMMARY: "/payments/summary",
  },

  LOCOMOTIVES: {
    BASE: "/locomotives",
    BY_ID: (id: string) => `/locomotives/${id}`,
    DECOMMISSION: (id: string) => `/locomotives/${id}/decommission`,
  },

  ROUTES: {
    BASE: "/routes",
    BY_ID: (id: string) => `/routes/${id}`,
  },

  TRAIN_SCHEDULING: {
    ELIGIBLE_BOOKINGS: "/train-scheduling/eligible-bookings",
    BOOKABLE_SCHEDULES: "/train-scheduling/bookable-schedules",
    AVAILABLE_DAYS: "/train-scheduling/available-days",
    AVAILABLE_DAYS_FOR_CARGO: "/train-scheduling/available-days-for-cargo",
    AVAILABLE_LOCOMOTIVES: "/train-scheduling/available-locomotives",
    BATCH_BOARD: "/train-scheduling/batch-board",
    BATCH_BOARD_DETAIL: (scheduleId: string) =>
      `/train-scheduling/batch-board/${scheduleId}`,
    RUN_BATCH: (id: string) => `/train-scheduling/schedules/${id}/run-batch`,
    RUN_ALLOCATION: (id: string) =>
      `/train-scheduling/schedules/${id}/run-allocation`,
    DOC_REVIEW_COMPLETE: (id: string) =>
      `/train-scheduling/schedules/${id}/doc-review-complete`,
    DOC_REVIEW_ALERT: "/train-scheduling/doc-review-alert",
    ASSIGN_UNASSIGNED_BOOKING: (id: string) =>
      `/train-scheduling/schedules/${id}/assign-unassigned-booking`,
    BOOKING_WINDOW: (id: string) =>
      `/train-scheduling/schedules/${id}/booking-window`,
    WINDOW_RULE: (id: string) =>
      `/train-scheduling/schedules/${id}/window-rule`,
    SCHEDULE_DATE: (id: string) =>
      `/train-scheduling/schedules/${id}/schedule-date`,
    CONTRACT_BOOKING_WINDOWS: (contractId: string) =>
      `/train-scheduling/contracts/${contractId}/booking-windows`,
    MARK_BOOKING_PAID: (bookingId: string) =>
      `/train-scheduling/bookings/${bookingId}/mark-paid`,
    EXPIRE_BOOKING: (bookingId: string) =>
      `/train-scheduling/bookings/${bookingId}/expire`,
    MOVE_BOOKING_SCHEDULE: (bookingId: string) =>
      `/train-scheduling/bookings/${bookingId}/move-schedule`,
    GLOBAL_RULES: "/train-scheduling/global-rules",
    BOOKING_WINDOWS: "/train-scheduling/booking-windows",
    PREVIEW: "/train-scheduling/preview",
    ASSIGN_BOOKINGS: (id: string) =>
      `/train-scheduling/schedules/${id}/assign-bookings`,
    CONTAINER: {
      ELIGIBLE_BOOKINGS: "/train-scheduling/container/eligible-bookings",
      PREVIEW: "/train-scheduling/container/preview",
      SCHEDULES: "/train-scheduling/container/schedules",
      SCHEDULE_BY_ID: (id: string) =>
        `/train-scheduling/container/schedules/${id}`,
      ASSIGN_BOOKINGS: (id: string) =>
        `/train-scheduling/container/schedules/${id}/assign-bookings`,
      CANCEL_SCHEDULE: (id: string) =>
        `/train-scheduling/container/schedules/${id}/cancel`,
    },
    BULK: {
      ELIGIBLE_BOOKINGS: "/train-scheduling/bulk/eligible-bookings",
      PREVIEW: "/train-scheduling/bulk/preview",
      SCHEDULES: "/train-scheduling/bulk/schedules",
      SCHEDULE_BY_ID: (id: string) => `/train-scheduling/bulk/schedules/${id}`,
      ASSIGN_BOOKINGS: (id: string) =>
        `/train-scheduling/bulk/schedules/${id}/assign-bookings`,
      CANCEL_SCHEDULE: (id: string) =>
        `/train-scheduling/bulk/schedules/${id}/cancel`,
    },
    UNASSIGN_BOOKING: (scheduleId: string, bookingId: string) =>
      `/train-scheduling/schedules/${scheduleId}/bookings/${bookingId}`,
    PIN_WAGONS: (id: string) => `/train-scheduling/schedules/${id}/pin-wagons`,
    FINALIZE: (id: string) => `/train-scheduling/schedules/${id}/finalize`,
    DISPATCH: (id: string) => `/train-scheduling/schedules/${id}/dispatch`,
    YARD_WORK: (id: string) => `/train-scheduling/schedules/${id}/yard-work`,
    BOOKING_LOAD: (id: string, bookingId: string) =>
      `/train-scheduling/schedules/${id}/bookings/${bookingId}/load`,
    BOOKING_UNLOAD: (id: string, bookingId: string) =>
      `/train-scheduling/schedules/${id}/bookings/${bookingId}/unload`,
    INTERCITY_BOOKINGS: "/train-scheduling/intercity/bookings",
    INTERCITY_CANDIDATES: (id: string) =>
      `/train-scheduling/schedules/${id}/intercity-candidates`,
    INTERCITY_ACCEPT: (id: string) =>
      `/train-scheduling/schedules/${id}/intercity/accept`,
    INTERCITY_LOAD: (id: string, bookingId: string) =>
      `/train-scheduling/schedules/${id}/intercity/${bookingId}/load`,
    INTERCITY_UNLOAD: (id: string, bookingId: string) =>
      `/train-scheduling/schedules/${id}/intercity/${bookingId}/unload`,
    IMPORT_LOADING_BOOKINGS: (id: string) =>
      `/train-scheduling/schedules/${id}/import-loading-bookings`,
    IMPORT_LOADING_STATUS: (id: string) =>
      `/train-scheduling/schedules/${id}/import-loading-status`,
    LOADING_STATUS: (id: string) =>
      `/train-scheduling/schedules/${id}/loading-status`,
    CONFIRM_LOADING: (id: string) =>
      `/train-scheduling/schedules/${id}/confirm-loading`,
    IMPORT_DJIBOUTI: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti`,
    IMPORT_DJIBOUTI_DOCUMENTS: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/documents`,
    IMPORT_DJIBOUTI_GATEPASS_GRANTED: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/gatepass-granted`,
    IMPORT_DJIBOUTI_READY_FOR_LOADING: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/ready-for-loading`,
    IMPORT_DJIBOUTI_LOADED_ON_TRAIN: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/loaded-on-train`,
    IMPORT_DJIBOUTI_DEPART: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/depart`,
    IMPORT_DJIBOUTI_LOAD_LIST: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/load-list`,
    IMPORT_DJIBOUTI_LOAD_LIST_DOCUMENT: (id: string) =>
      `/train-scheduling/schedules/${id}/import-djibouti/load-list/document`,
    EXPORT_LOAD_LIST_DOCUMENT: (id: string) =>
      `/train-scheduling/schedules/${id}/export/load-list/document`,
    CHECKPOINTS: (id: string) =>
      `/train-scheduling/schedules/${id}/checkpoints`,
    ARRIVE: (id: string) => `/train-scheduling/schedules/${id}/arrive`,
    RESCHEDULE_PREVIEW: (id: string) =>
      `/train-scheduling/schedules/${id}/reschedule/preview`,
    RESCHEDULE_EXECUTE: (id: string) =>
      `/train-scheduling/schedules/${id}/reschedule/execute`,
    MAINTENANCE: (id: string) =>
      `/train-scheduling/schedules/${id}/maintenance`,
    SCHEDULES: "/train-scheduling/container/schedules",
    SCHEDULE_BY_ID: (id: string) =>
      `/train-scheduling/container/schedules/${id}`,
    CANCEL_SCHEDULE: (id: string) =>
      `/train-scheduling/container/schedules/${id}/cancel`,
    REMOVE_WAGON_SLOT: (scheduleId: string, wagonId: string) =>
      `/train-scheduling/schedules/${scheduleId}/wagons/${wagonId}`,
    UPDATE_CONTAINER_ITEM: (scheduleId: string, itemId: string) =>
      `/train-scheduling/schedules/${scheduleId}/container-items/${itemId}`,
    MOVE_WAGON_LOAD: (scheduleId: string, wagonId: string) =>
      `/train-scheduling/schedules/${scheduleId}/wagons/${wagonId}/move-load`,
    UNASSIGNED_BOOKINGS: (scheduleId: string) =>
      `/train-scheduling/schedules/${scheduleId}/unassigned-bookings`,
    COMPOSITION_REMOVALS: (scheduleId: string) =>
      `/train-scheduling/schedules/${scheduleId}/composition-removals`,
  },

  RULE_ENGINE: {
    CARGO_TYPES: "/cargo-types",
    CARGO_TYPE_BY_ID: (id: string) => `/cargo-types/${id}`,

    CONTAINER_TYPES: "/container-types",
    CONTAINER_TYPE_BY_ID: (id: string) => `/container-types/${id}`,

    WAGON_TYPES: "/wagon-types",
    WAGON_TYPE_BY_ID: (id: string) => `/wagon-types/${id}`,

    TRUCK_TYPES: "/truck-types",
    TRUCK_TYPE_BY_ID: (id: string) => `/truck-types/${id}`,

    PRIORITY_CONFIGS: "/priority-configs",
    PRIORITY_CONFIG_BY_ID: (id: string) => `/priority-configs/${id}`,

    SERVICE_TYPES: "/service-types",
    SERVICE_TYPE_BY_ID: (id: string) => `/service-types/${id}`,

    WEIGHT_LIMIT_RULES: "/weight-limit-rules",
    WEIGHT_LIMIT_RULE_BY_ID: (id: string) => `/weight-limit-rules/${id}`,

    YARDS: "/yards",
    YARD_BY_ID: (id: string) => `/yards/${id}`,

    YARD_DISTANCES: "/yard-distances",
    YARD_DISTANCE_BY_ID: (id: string) => `/yard-distances/${id}`,

    SHIPPING_LINES: "/shipping-lines",
    SHIPPING_LINE_BY_ID: (id: string) => `/shipping-lines/${id}`,

    RATES: "/rates",
    RATES_LIVE: "/rates/live",
    RATE_BY_ID: (id: string) => `/rates/${id}`,
    RATE_SUBMIT: (id: string) => `/rates/${id}/submit`,
    RATE_APPROVE: (id: string) => `/rates/${id}/approve`,

    APPROVAL_RULES: "/approval-rules",
    APPROVAL_RULE_BY_ID: (id: string) => `/approval-rules/${id}`,
    APPROVAL_RULES_CHAIN: "/approval-rules/chain",
    APPROVAL_RULES_POSITION_TYPES: "/approval-rules/position-types",
  },
  RATE_MATRIX: {
    BASE: "/api/rate-matrices",
    DRAFT: "/api/rate-matrices/draft",
    SUBMIT: (id: string) => `/api/rate-matrices/${id}/submit`,
    AUTHORIZE: (id: string) => `/api/rate-matrices/${id}/authorize`,
    LIST: "/api/rate-matrices",
    DETAIL: (id: string) => `/api/rate-matrices/${id}`,
  },
  REFERENCE: {
    PORTS: "/api/reference/ports",
    CITIES: "/api/reference/cities",
    CONTAINER_TYPES: "/api/reference/container-types",
    CURRENCIES: "/api/reference/currencies",
  },

  FACILITIES: {
    BASE: "/facilities",
    BY_ID: (id: string) => `/facilities/${id}`,
  },

  WAREHOUSES: {
    BASE: "/warehouses",
    DASHBOARD: "/warehouses/dashboard",
    BY_ID: (id: string) => `/warehouses/${id}`,
    YARDS: (warehouseId: string) => `/warehouses/${warehouseId}/yards`,
  },

  WAREHOUSE_YARDS: {
    BASE: "/warehouse-yards",
    BY_ID: (id: string) => `/warehouse-yards/${id}`,
    ZONES: (yardId: string) => `/warehouse-yards/${yardId}/zones`,
  },

  WAREHOUSE_ZONES: {
    BASE: "/warehouse-zones",
    BY_ID: (id: string) => `/warehouse-zones/${id}`,
  },

  WAREHOUSE_INVENTORY: {
    BASE: "/warehouse-inventory",
    RECEIVE: "/warehouse-inventory/receive",
    DASHBOARD_SUMMARY: "/warehouse-inventory/dashboard/summary",
    READY_FOR_LOADING: "/warehouse-inventory/ready-for-loading",
    INQUIRY: "/warehouse-inventory/inquiry",
    STORE: (id: string) => `/warehouse-inventory/${id}/store`,
    INSPECT: (id: string) => `/warehouse-inventory/${id}/inspect`,
    MARK_READY: (id: string) => `/warehouse-inventory/${id}/ready-for-loading`,
    LOAD: (id: string) => `/warehouse-inventory/${id}/load`,
    DISPATCH: (id: string) => `/warehouse-inventory/${id}/dispatch`,
    MOVE: (id: string) => `/warehouse-inventory/${id}/move`,
    RESERVE: "/warehouse-inventory/reserve",
    ARRIVAL_QUEUE: "/warehouse-inventory/arrival-queue",
    OPS_STATS: "/warehouse-inventory/ops-stats",
    TRUCKS_ON_SITE: "/warehouse-inventory/trucks-on-site",
    THROUGHPUT: (granularity: 'week' | 'month' | 'year') =>
      `/warehouse-inventory/throughput?granularity=${granularity}`,
    DWELL_STATS: "/warehouse-inventory/dwell-stats",
    CYCLE_STATS: "/warehouse-inventory/cycle-stats",
    GATE_STATS: "/warehouse-inventory/gate-stats",
    ZONE_OCCUPANCY: (yardId?: string) =>
      yardId
        ? `/warehouse-inventory/zone-occupancy?yardId=${yardId}`
        : "/warehouse-inventory/zone-occupancy",
    AUTO_UNLOAD_ARRIVED: "/warehouse-inventory/auto-unload-arrived",
    AUTO_LOAD_READY: "/warehouse-inventory/auto-load-ready",
    UNLOAD_BOOKING: (bookingId: string) =>
      `/warehouse-inventory/bookings/${bookingId}/unload`,
    INSPECTION_REPORTS: (inventoryId: string) =>
      `/warehouse-inventory/${inventoryId}/inspection-reports`,
    LOADABLE_WAGONS: "/warehouse-inventory/loadable-wagons",
    BOOKING_SCHEDULE: (bookingId: string) =>
      `/warehouse-inventory/booking/${bookingId}/schedule`,
    MOVEMENTS: (id: string) => `/warehouse-inventory/${id}/movements`,
    ACTIVITY: (id: string) => `/warehouse-inventory/${id}/activity`,
    LOADINGS: (id: string) => `/warehouse-inventory/${id}/loadings`,
    // Import branch
    MARK_READY_PICKUP: (id: string) =>
      `/warehouse-inventory/${id}/ready-for-pickup`,
    RELEASE: (id: string) => `/warehouse-inventory/${id}/release`,
    RELEASE_DOCUMENT: (id: string) =>
      `/warehouse-inventory/${id}/release-document`,
    GRN_DOCUMENT: (id: string) => `/warehouse-inventory/${id}/grn-document`,
    HANDOVER_DOCUMENT: (id: string) =>
      `/warehouse-inventory/${id}/handover-document`,
    DELIVER: (id: string) => `/warehouse-inventory/${id}/deliver`,
    // Receive (Import/Export bulk)
    ELIGIBLE_BOOKINGS: (direction?: string) =>
      direction
        ? `/warehouse-inventory/eligible-bookings?direction=${direction}`
        : `/warehouse-inventory/eligible-bookings`,
    RECEIVE_BULK: "/warehouse-inventory/receive-bulk",
    LOAD_PASSED_EXPORT: "/warehouse-inventory/load-passed-export",
    BULK_MARK_INSPECTED: "/warehouse-inventory/bulk-mark-inspected",
    RECEIVED_EXPORT: "/warehouse-inventory/received-export",
    READY_TO_LOAD_EXPORT: "/warehouse-inventory/ready-to-load-export",
    LOADED_EXPORT: "/warehouse-inventory/loaded-export",
    BULK_DISPATCH_EXPORT: "/warehouse-inventory/bulk-dispatch-export",
    IMPORT_ARRIVE_QUEUE: "/warehouse-inventory/import/arrive-queue",
    IMPORT_TRAIN_ITEMS: (scheduleId: string) =>
      `/warehouse-inventory/import/trains/${scheduleId}/items`,
    IMPORT_AUTO_UNLOAD_ARRIVED:
      "/warehouse-inventory/import/auto-unload-arrived-bookings",
    IMPORT_UNLOADED_QUEUE: "/warehouse-inventory/import/unloaded-queue",
    IMPORT_PICKUP_READY_QUEUE: "/warehouse-inventory/import/pickup-ready-queue",
    EXPORT_DJIBOUTI_ARRIVAL_QUEUE:
      "/warehouse-inventory/export/djibouti-arrival-queue",
    EXPORT_DJIBOUTI_TRAIN_ITEMS: (scheduleId: string) =>
      `/warehouse-inventory/export/djibouti-trains/${scheduleId}/items`,
    EXPORT_AUTO_UNLOAD_AT_DJIBOUTI:
      "/warehouse-inventory/export/auto-unload-at-djibouti",
  },

  WAREHOUSE_LOADINGS: {
    BASE: "/warehouse-loadings",
  },

  WAREHOUSE_INSPECTION: {
    BY_ID: (id: string) => `/warehouse-inspection-reports/${id}`,
    ATTACHMENTS: (id: string) =>
      `/warehouse-inspection-reports/${id}/attachments`,
  },

  WAREHOUSE_RULES: {
    ALLOCATION: "/warehouse-allocation-rules",
    ALLOCATION_BY_ID: (id: string) => `/warehouse-allocation-rules/${id}`,
    ALLOCATION_PREVIEW: "/warehouse-allocation/preview",
    FEES: "/warehouse-fee-rules",
    FEES_BY_ID: (id: string) => `/warehouse-fee-rules/${id}`,
    FEE_PREVIEW: (inventoryId: string) =>
      `/warehouse-inventory/${inventoryId}/fee-preview`,
    ACCRUAL_DASHBOARD: "/warehouse-fees/accrual-dashboard",
    ON_TIME_DISPATCH: "/warehouse-fees/on-time-dispatch",
    ACCRUAL_ACK: (inventoryId: string) =>
      `/warehouse-fees/accrual/${inventoryId}/acknowledge`,
  },

  WAREHOUSE_INVOICES: {
    BASE: "/warehouse-fee-invoices",
    BY_ID: (id: string) => `/warehouse-fee-invoices/${id}`,
    DOCUMENT: (id: string) => `/warehouse-fee-invoices/${id}/document`,
    RECEIPT: (id: string) => `/warehouse-fee-invoices/${id}/receipt`,
    CANCEL: (id: string) => `/warehouse-fee-invoices/${id}/cancel`,
    PAY: (id: string) => `/warehouse-fee-invoices/${id}/pay`,
    PAY_ONLINE: (id: string) => `/warehouse-fee-invoices/${id}/pay-online`,
    GENERATE: (inventoryId: string) =>
      `/warehouse-inventory/${inventoryId}/generate-fee-invoice`,
    FOR_INVENTORY: (inventoryId: string) =>
      `/warehouse-inventory/${inventoryId}/fee-invoices`,
    FOR_BOOKING: (bookingId: string) =>
      `/bookings/${bookingId}/warehouse-fee-invoices`,
    GATE_CLEARANCE: (inventoryId: string) =>
      `/warehouse-inventory/${inventoryId}/gate-clearance`,
  },

  INTERCHANGE_DOCUMENTS: {
    BASE: "/interchange-documents",
    BY_ID: (id: string) => `/interchange-documents/${id}`,
    GENERATE_FROM_SCHEDULE: "/interchange-documents/generate-from-schedule",
    ACKNOWLEDGE: (id: string) => `/interchange-documents/${id}/acknowledge`,
    DISPUTE: (id: string) => `/interchange-documents/${id}/dispute`,
    CANCEL: (id: string) => `/interchange-documents/${id}/cancel`,
  },

  IMPORT_OPERATIONS: {
    DJIBOUTI_INCIDENTS: "/import-operations/djibouti-incidents",
    CUSTOMS: (bookingId: string) => `/import-operations/customs/${bookingId}`,
    CUSTOMS_DOCUMENTS: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/documents`,
    CUSTOMS_DECLARATION: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/declaration`,
    CUSTOMS_NOTIFY_DUTIES_TAXES: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/notify-duties-taxes`,
    CUSTOMS_DUTIES_TAXES_PAID: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/duties-taxes-paid`,
    CUSTOMS_RISK: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/risk`,
    CUSTOMS_RELEASE_PERMITTED: (bookingId: string) =>
      `/import-operations/customs/${bookingId}/release-permitted`,
    EMPTY_CONTAINER_RETURNS: "/import-operations/empty-container-returns",
    EMPTY_CONTAINER_RETURN_STATUS: (id: string) =>
      `/import-operations/empty-container-returns/${id}/status`,
  },

  VEHICLES: {
    BASE: "/vehicles",
    BY_ID: (id: string) => `/vehicles/${id}`,
  },

  FIRST_MILE: {
    BASE: "/first-mile",
    BY_ID: (id: string) => `/first-mile/${id}`,
    ACCEPT: (reference: string) => `/first-mile/accept/${reference}`,
  },

  LAST_MILE: {
    BASE: "/last-mile",
    BY_ID: (id: string) => `/last-mile/${id}`,
    ACCEPT: (reference: string) => `/last-mile/accept/${reference}`,
    PROOF_OF_DELIVERY: (id: string) => `/last-mile/${id}/proof-of-delivery`,
  },

  DRIVERS: {
    BASE: "/drivers",
    BY_ID: (id: string) => `/drivers/${id}`,
  },
};
