/**
 * E2E route map per role.
 *
 * Source of truth: client/src/App.tsx (getRoutes() per role).
 * Keep this in sync when new routes are added — the smoke tests walk
 * every entry here.
 *
 * Routes that require dynamic params (`:id`, `:uid`) are recorded with a
 * sample placeholder. The smoke test only checks that the route mounts,
 * not that the resource exists. A 200/200ish page with an "id not found"
 * empty state is still considered "mounted" — the goal is to catch
 * crashes, auth errors, and ProtectedRoute misconfigurations.
 */
import type { PortalRole } from './auth';

export const ROLE_LANDING: Record<PortalRole, string> = {
  school_admin:    '/dashboard/admin',
  systems_admin:   '/dashboard/admin',
  principal:       '/dashboard/admin',
  hr:              '/dashboard/admin',
  bursar:          '/dashboard/admin',
  accountant:      '/dashboard/accountant',
  nurse:           '/dashboard/nurse',
  dining_staff:    '/dashboard/dining',
  teacher:         '/dashboard/teacher',
  librarian:       '/dashboard/librarian',
  clubs_head:      '/dashboard/clubs_head',
  student:         '/dashboard/student',
  parent:          '/dashboard/parent',
  driver:          '/dashboard/admin',
  groundsman:      '/dashboard/admin',
  matron:          '/dashboard/admin',
  boarding_master: '/dashboard/admin',
  security:        '/dashboard/admin',
  janitor:         '/dashboard/admin',
};

/**
 * The full set of routes each role can reach. Hand-curated from App.tsx
 * to keep portal specs independent of the router's internal structure.
 *
 * `paramRoutes` are paths with `:id` / `:uid` placeholders; the smoke
 * test uses the first available real id from a list response, or
 * `placeholder` as a fallback.
 */
export const ROUTES_PER_ROLE: Record<PortalRole, string[]> = {
  school_admin: [
    // Dashboards
    '/dashboard/admin',
    '/dashboard/hr',
    '/dashboard/finance',
    // Core admin
    '/users',
    '/students',
    '/teachers',
    '/classes',
    // Phase 1 PR 3: class detail page
    '/admin/classes/1',
    // Phase 1 PR 2: cohorts
    '/admin/cohorts',
    '/attendance',
    '/departments',
    '/reports',
    '/fees',
    '/settings',
    '/profile',
    // Library + inventory
    '/library',
    '/inventory',
    // HR
    '/hr/management',
    '/hr/attendance',
    '/hr/leave-approval',
    '/hr/staff',
    // Front office
    '/front-office/visitors',
    '/front-office/enquiries',
    '/front-office/complaints',
    '/front-office/phone-calls',
    '/front-office/postal',
    // Hostel / transport
    '/hostels',
    '/transport',
    // Marks / academic
    '/attendance/take',
    '/attendance/history',
    '/admin/academic-rollover',
    '/marks/bulk',
    // Finance surface
    '/finance/expenses',
    '/finance/payroll/runs',
    '/finance/payslips',
    '/finance/suppliers',
    '/finance/chart-of-accounts',
    '/finance/invoices',
    '/finance/trips',
    '/finance/banking',
    '/finance/groups',
    '/finance/plans',
    '/finance/discounts',
    // Medical
    '/sanatorium',
    '/dining-hall',
    // Shared
    '/extracurriculars',
    '/messages',
    '/events',
    '/notice-board',
    '/enrollments',
  ],
  systems_admin: [
    '/dashboard/admin',
    '/settings',
    '/audit-logs',
    '/sync-logs',
    '/users',
    '/departments',
    // Phase 1 PR 2: cohorts (admin can manage)
    '/admin/cohorts',
    '/reports',
    '/fees',
    '/hr/attendance',
    '/attendance/take',
    '/attendance/history',
    '/front-office/visitors',
    '/front-office/enquiries',
    '/front-office/complaints',
    '/front-office/phone-calls',
    '/front-office/postal',
    '/admin/academic-rollover',
    '/marks/bulk',
    '/sanatorium',
    '/dining-hall',
    '/extracurriculars',
    '/notice-board',
    '/messages',
    '/events',
    '/profile',
    '/enrollments',
  ],
  teacher: [
    '/dashboard/teacher',
    '/my-courses',
    '/assignments',
    '/students',
    '/attendance/take',
    '/attendance/history',
    '/homework',
    '/tests',
    '/resources',
    '/class-room',
    '/front-office/visitors',
    '/extracurriculars',
    '/messages',
    '/events',
    '/notice-board',
    '/profile',
    '/enrollments',
  ],
  student: [
    '/dashboard/student',
    '/exams',
    '/grades',
    '/assignments',
    '/my-courses',
    '/enrollments',
    '/medical',
    '/homework',
    '/tests',
    '/resources',
    '/report-card',
    '/fees',
    '/extracurriculars',
    '/messages',
    '/events',
    '/notice-board',
    '/profile',
  ],
  parent: [
    '/dashboard/parent',
    '/academic-progress',
    '/calendar',
    '/attendance',
    '/attendance/history',
    '/fees',
    '/extracurriculars',
    '/resources',
    '/medical',
    '/messages',
    '/events',
    '/notice-board',
    '/profile',
    '/enrollments',
  ],
  // Unused in this push — left as empty arrays to keep the type honest.
  // Other portals (HR, bursar, librarian, clubs_head, principal, nurse,
  // dining_staff, support roles) get their own spec in a follow-up.
  principal:       [],
  hr:              [],
  bursar:          [],
  accountant:      [],
  nurse:           [],
  dining_staff:    [],
  librarian:       [],
  clubs_head:      [],
  driver:          [],
  groundsman:      [],
  matron:          [],
  boarding_master: [],
  security:        [],
  janitor:         [],
};
