import { lazy } from 'react'
import type { RouteObject } from 'react-router'

const ShiftHistoryPage = lazy(() => import('./pages/ShiftHistoryPage'))
const ShiftDetailPage = lazy(() => import('./pages/ShiftDetailPage'))
const CashMismatchReasonsPage = lazy(() =>
  import('./pages/ReasonsPage').then((m) => ({ default: m.CashMismatchReasonsPage })),
)
const AdjustmentReasonsPage = lazy(() =>
  import('./pages/ReasonsPage').then((m) => ({ default: m.AdjustmentReasonsPage })),
)
const ReturnReasonsPage = lazy(() =>
  import('./pages/ReasonsPage').then((m) => ({ default: m.ReturnReasonsPage })),
)

/**
 * Shifts & cash-drawer routes — mounted as children of the authenticated
 * AppShell, so paths carry no leading slash. Per
 * the page inventory's Part B (§4 Shifts & Cash):
 * Shift History (T1), Shift Detail (T4), and the typed-reason config screens
 * (T2) for cash-mismatch, adjustment and return reasons. Pages are code-split
 * (React.lazy) — resolved under the shell's <Suspense>.
 */
export const shiftsRoutes: RouteObject[] = [
  { path: 'shifts', element: <ShiftHistoryPage /> },
  { path: 'shifts/:id', element: <ShiftDetailPage /> },
  { path: 'settings/reasons/cash', element: <CashMismatchReasonsPage /> },
  { path: 'settings/reasons/adjustments', element: <AdjustmentReasonsPage /> },
  { path: 'settings/reasons/returns', element: <ReturnReasonsPage /> },
]

export default shiftsRoutes
