import type { CampusId, CampusInfo } from '@/shared/types/app';

export interface CampusAttendanceConfigViewModel {
  readonly id: string;
  readonly campus_id: CampusId;
  readonly attendance_link: string | null;
  readonly updated_by: string | null;
  readonly updated_at: string;
}

export interface CampusAttendanceSummaryViewModel {
  readonly id: string;
  readonly campus_id: CampusId;
  readonly date: string;
  readonly total_enrolled: number;
  readonly total_present: number;
  readonly total_absent: number;
  readonly total_tardy: number;
  readonly attendance_percentage: number;
  readonly recorded_by: string | null;
  readonly notes: string | null;
}

export interface CampusAttendanceEntryInput {
  readonly campusId: CampusId;
  readonly date: string;
  readonly totalEnrolled: number;
  readonly totalPresent: number;
  readonly totalAbsent: number;
  readonly totalTardy: number;
  readonly notes: string | null;
}

export interface CampusAttendanceStats extends CampusInfo {
  readonly todayPct: number | null;
  readonly weekAvg: number | null;
  readonly config: CampusAttendanceConfigViewModel | null;
  readonly recentData: readonly CampusAttendanceSummaryViewModel[];
  readonly todayRecord: CampusAttendanceSummaryViewModel | null;
}

export interface CampusAttendanceOverallStats {
  readonly todayRecords: readonly CampusAttendanceSummaryViewModel[];
  readonly todayEnrolled: number;
  readonly todayPresent: number;
  readonly todayPct: number | null;
  readonly weekRecords: readonly CampusAttendanceSummaryViewModel[];
  readonly weekPct: number | null;
}

export interface CampusAttendanceEntryDraft {
  readonly date: string;
  readonly enrolled: string;
  readonly present: string;
  readonly absent: string;
  readonly tardy: string;
  readonly notes: string;
}

export interface CampusAttendanceRoleAccess {
  readonly isSuperintendent: boolean;
  readonly isDirector: boolean;
  readonly isOfficeManager: boolean;
  readonly canSeeAllCampuses: boolean;
  readonly canEnterData: boolean;
  readonly canPrint: boolean;
}

export interface CampusAttendancePrintInput {
  readonly reportTitle: string;
  readonly generatedByName: string;
  readonly generatedByRole: string;
  readonly today: string;
  readonly weekStart: string;
  readonly campusesToPrint: readonly CampusAttendanceStats[];
  readonly printTodayRecords: readonly CampusAttendanceSummaryViewModel[];
  readonly printWeekRecords: readonly CampusAttendanceSummaryViewModel[];
}
