import type { WalkthroughRatingKey } from '@/shared/types/walkthrough';

export interface WalkthroughRatingOption {
  readonly value: number;
  readonly label: string;
  readonly color: string;
  readonly bg: string;
}

export interface WalkthroughFormCategory {
  readonly key: WalkthroughRatingKey;
  readonly label: string;
  readonly shortLabel: string;
  readonly tooltip: string;
  readonly ratings: readonly WalkthroughRatingOption[];
  readonly max: number;
}

export type WalkthroughSummaryRange = '30' | '60' | '90';

export const WALKTHROUGH_REPORT_FALLBACK_DIRECTOR_LABEL = 'Director';
export const WALKTHROUGH_REPORT_FALLBACK_CAMPUS_LABEL = 'Current Campus';
export const WALKTHROUGH_AVERAGE_COMPLETION_LABEL = '~3 min';

export const WALKTHROUGH_QUERY_KEYS = {
  checkins: ['walkthroughCheckins'],
} as const;

export const WALKTHROUGH_SUMMARY_RANGES: readonly WalkthroughSummaryRange[] = ['30', '60', '90'];

export const WALKTHROUGH_STANDARD_RATINGS: readonly WalkthroughRatingOption[] = [
  { value: 4, label: 'Excellent', color: 'text-emerald-400', bg: 'bg-emerald-500/15 border-emerald-500/30' },
  { value: 3, label: 'Satisfactory', color: 'text-blue-400', bg: 'bg-blue-500/15 border-blue-500/30' },
  { value: 2, label: 'Needs Attention', color: 'text-amber-400', bg: 'bg-amber-500/15 border-amber-500/30' },
  { value: 1, label: 'Immediate Support Needed', color: 'text-red-400', bg: 'bg-red-500/15 border-red-500/30' },
];

export const WALKTHROUGH_EXIT_RATINGS: readonly WalkthroughRatingOption[] = [
  { value: 3, label: 'Clearly visible & accessible', color: 'text-emerald-400', bg: 'bg-emerald-500/15 border-emerald-500/30' },
  { value: 2, label: 'Present but needs adjustment', color: 'text-amber-400', bg: 'bg-amber-500/15 border-amber-500/30' },
  { value: 1, label: 'Missing items', color: 'text-red-400', bg: 'bg-red-500/15 border-red-500/30' },
];

export const WALKTHROUGH_LESSON_RATINGS: readonly WalkthroughRatingOption[] = [
  { value: 3, label: 'Posted & aligned', color: 'text-emerald-400', bg: 'bg-emerald-500/15 border-emerald-500/30' },
  { value: 2, label: 'Completed but not posted', color: 'text-amber-400', bg: 'bg-amber-500/15 border-amber-500/30' },
  { value: 1, label: 'Incomplete', color: 'text-red-400', bg: 'bg-red-500/15 border-red-500/30' },
];

export const WALKTHROUGH_FORM_CATEGORIES: readonly WalkthroughFormCategory[] = [
  {
    key: 'attitude',
    label: '1. Attitude',
    shortLabel: 'Attitude',
    tooltip: 'Professional tone, engagement, responsiveness to students and staff.',
    ratings: WALKTHROUGH_STANDARD_RATINGS,
    max: 4,
  },
  {
    key: 'classroom_management',
    label: '2. Classroom Management',
    shortLabel: 'Classroom Mgmt',
    tooltip: 'Transitions, student regulation, structure, consistency of routines.',
    ratings: WALKTHROUGH_STANDARD_RATINGS,
    max: 4,
  },
  {
    key: 'cleanliness',
    label: '3. Cleanliness / Organization',
    shortLabel: 'Cleanliness',
    tooltip: 'Materials organized, visual structure, safe environment, clutter-free.',
    ratings: WALKTHROUGH_STANDARD_RATINGS,
    max: 4,
  },
  {
    key: 'vibes',
    label: '4. Vibes / Feeling Welcomed',
    shortLabel: 'Vibes / Welcome',
    tooltip: 'Warmth, student engagement, emotional tone, inviting atmosphere.',
    ratings: WALKTHROUGH_STANDARD_RATINGS,
    max: 4,
  },
  {
    key: 'team_dynamics',
    label: '5. Team Dynamics',
    shortLabel: 'Team Dynamics',
    tooltip: 'Paraprofessional collaboration, communication, alignment on goals.',
    ratings: WALKTHROUGH_STANDARD_RATINGS,
    max: 4,
  },
  {
    key: 'emergency_exit',
    label: '6. Emergency Exit Items by Door',
    shortLabel: 'Emergency Exit',
    tooltip: 'Emergency binder, class roster, first aid kit, and exit map visible and accessible.',
    ratings: WALKTHROUGH_EXIT_RATINGS,
    max: 3,
  },
  {
    key: 'lesson_plan',
    label: '7. Lesson Plan Completed & Accessible',
    shortLabel: 'Lesson Plan',
    tooltip: 'Lesson plan posted, aligned with IEP goals, and accessible for review.',
    ratings: WALKTHROUGH_LESSON_RATINGS,
    max: 3,
  },
];

export const WALKTHROUGH_RATING_KEYS: readonly WalkthroughRatingKey[] = WALKTHROUGH_FORM_CATEGORIES.map(
  (category) => category.key,
);
