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`,
    BOOKINGS_CUSTOMER_VIEW: (id: string) => `/bookings/by-company/${id}/customer-view`,
    PAYMENTS_CUSTOMER_VIEW: (id: string) => `/payments/by-company/${id}/customer-view`,
  },

  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",
    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`,
    APPROVE_STEP: (id: string, stepId: string) =>
      `/bookings/${id}/approval-steps/${stepId}/approve`,
    REJECT_STEP: (id: string, stepId: string) =>
      `/bookings/${id}/approval-steps/${stepId}/reject`,
    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`,
  },

  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_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`,
    ASSIGN_UNASSIGNED_BOOKING: (id: string) =>
      `/train-scheduling/schedules/${id}/assign-unassigned-booking`,
    BOOKING_WINDOW: (id: string) => `/train-scheduling/schedules/${id}/booking-window`,
    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",
    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`,
    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}`,
    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}`,

    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}`,

    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",
  },
   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: {
    BY_ID: (id: string) => `/warehouse-yards/${id}`,
    ZONES: (yardId: string) => `/warehouse-yards/${yardId}/zones`,
  },

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

  WAREHOUSE_INVENTORY: {
    BASE: '/warehouse-inventory',
    RECEIVE: '/warehouse-inventory/receive',
    RESERVE: '/warehouse-inventory/reserve',
    ARRIVAL_QUEUE: '/warehouse-inventory/arrival-queue',
    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`,
    READY_FOR_LOADING: '/warehouse-inventory/ready-for-loading',
    INQUIRY: '/warehouse-inventory/inquiry',
    LOADABLE_WAGONS: '/warehouse-inventory/loadable-wagons',
    BOOKING_SCHEDULE: (bookingId: string) => `/warehouse-inventory/booking/${bookingId}/schedule`,
    MOVE: (id: string) => `/warehouse-inventory/${id}/move`,
    MOVEMENTS: (id: string) => `/warehouse-inventory/${id}/movements`,
    ACTIVITY: (id: string) => `/warehouse-inventory/${id}/activity`,
    LOADINGS: (id: string) => `/warehouse-inventory/${id}/loadings`,
    STORE: (id: string) => `/warehouse-inventory/${id}/store`,
    MARK_READY: (id: string) => `/warehouse-inventory/${id}/ready-for-loading`,
    LOAD: (id: string) => `/warehouse-inventory/${id}/load`,
    DISPATCH: (id: string) => `/warehouse-inventory/${id}/dispatch`,
    // Import branch
    MARK_READY_PICKUP: (id: string) => `/warehouse-inventory/${id}/ready-for-pickup`,
    RELEASE: (id: string) => `/warehouse-inventory/${id}/release`,
    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',
    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',
  },

  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`,
  },

  WAREHOUSE_INVOICES: {
    BASE: '/warehouse-fee-invoices',
    BY_ID: (id: string) => `/warehouse-fee-invoices/${id}`,
    CANCEL: (id: string) => `/warehouse-fee-invoices/${id}/cancel`,
    PAY: (id: string) => `/warehouse-fee-invoices/${id}/pay`,
    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`,
  },

  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}`,
  },

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