import type { Module, UserRole } from '@/shared/types/app';
import { APP_ROUTE_PATHS } from '@/shared/constants/routes';

// Role groups for module visibility (frontend UX gating; the backend remains the
// authority). Admin tier (system + organization scope) sees everything.
const ADMIN: readonly UserRole[] = [
  'super_admin',
  'system_admin',
  'owner',
  'superintendent',
];
const ALL_STAFF: readonly UserRole[] = [
  ...ADMIN,
  'director',
  'office_manager',
  'teacher',
  'support_staff',
];
// Campus modules office_manager does not get (classroom/instructional tools).
const STAFF_NO_OFFICE: readonly UserRole[] = [
  ...ADMIN,
  'director',
  'teacher',
  'support_staff',
];
// Parent communication: teaching staff + admin (no support/office).
const PARENT_COMM: readonly UserRole[] = [...ADMIN, 'director', 'teacher'];
// Director-only surfaces (dashboard, walkthrough).
const DIRECTOR_ONLY: readonly UserRole[] = [...ADMIN, 'director'];
// External-facing pages: all staff plus students and guardians.
const EXTERNAL: readonly UserRole[] = [...ALL_STAFF, 'student', 'guardian'];

export const MODULES: Module[] = [
  { id: 'dashboard', name: 'Home Dashboard', icon: 'home', roles: ALL_STAFF, color: 'bg-violet-500', routePath: APP_ROUTE_PATHS.dashboard },
  { id: 'frame', name: 'F.R.A.M.E. Weekly', icon: 'frame', roles: ALL_STAFF, color: 'bg-amber-500', routePath: APP_ROUTE_PATHS.frame },
  { id: 'classroom', name: 'Classroom Support', icon: 'book', roles: STAFF_NO_OFFICE, color: 'bg-emerald-500', routePath: APP_ROUTE_PATHS.classroom },
  { id: 'timer', name: 'Classroom Timer', icon: 'timer', roles: STAFF_NO_OFFICE, color: 'bg-cyan-500', routePath: APP_ROUTE_PATHS.timer },
  { id: 'qbs', name: 'Behavior Management', icon: 'shield', roles: STAFF_NO_OFFICE, color: 'bg-blue-500', routePath: APP_ROUTE_PATHS.qbs },
  { id: 'ei', name: 'Emotional Intelligence', icon: 'heart', roles: ALL_STAFF, color: 'bg-pink-500', routePath: APP_ROUTE_PATHS.ei },
  { id: 'zones', name: 'Regulate your Zone', icon: 'layers', roles: STAFF_NO_OFFICE, color: 'bg-teal-500', routePath: APP_ROUTE_PATHS.zones },
  { id: 'signs', name: 'Sign Language', icon: 'hand', roles: STAFF_NO_OFFICE, color: 'bg-indigo-500', routePath: APP_ROUTE_PATHS.signs },
  { id: 'attendance', name: 'Attendance', icon: 'clock', roles: ALL_STAFF, color: 'bg-orange-500', routePath: APP_ROUTE_PATHS.attendance },
  { id: 'parent-comm', name: 'Parent Communication', icon: 'message', roles: PARENT_COMM, color: 'bg-cyan-500', routePath: APP_ROUTE_PATHS.parentComm },
  { id: 'internal-comm', name: 'Internal Alerts', icon: 'bell', roles: ALL_STAFF, color: 'bg-rose-500', routePath: APP_ROUTE_PATHS.internalComm },
  { id: 'safety', name: 'Safety Protocols', icon: 'alert', roles: ALL_STAFF, color: 'bg-red-500', routePath: APP_ROUTE_PATHS.safety },
  { id: 'handbook', name: 'Handbook & Policies', icon: 'file', roles: ALL_STAFF, color: 'bg-slate-600', routePath: APP_ROUTE_PATHS.handbook },
  { id: 'community', name: 'Community & Partnerships', icon: 'globe', roles: EXTERNAL, color: 'bg-green-600', routePath: APP_ROUTE_PATHS.community },
  { id: 'vocational', name: 'Vocational Opportunities', icon: 'briefcase', roles: EXTERNAL, color: 'bg-sky-600', routePath: APP_ROUTE_PATHS.vocational },
  { id: 'esa', name: 'ESA Funding Info', icon: 'wallet', roles: EXTERNAL, color: 'bg-emerald-600', routePath: APP_ROUTE_PATHS.esa },
  { id: 'walkthrough', name: 'Walk-Through Check-In', icon: 'clipboard', roles: DIRECTOR_ONLY, color: 'bg-indigo-600', routePath: APP_ROUTE_PATHS.walkthrough },
  { id: 'director', name: 'Director Dashboard', icon: 'chart', roles: DIRECTOR_ONLY, color: 'bg-purple-600', routePath: APP_ROUTE_PATHS.director },
];

export const HERO_IMAGE = 'https://d64gsuwffb70l.cloudfront.net/698a11e863624924473cfb17_1770658813159_517b0df6.jpg';
export const HANDBOOK_IMAGE = 'https://d64gsuwffb70l.cloudfront.net/698a11e863624924473cfb17_1770659087111_5a2d27c8.jpg';
