/**
 * Mock Data Presensi Digital SMA BPI 1 Bandung
 * CATATAN PENTING:
 * Seluruh data berikut adalah data simulasi (DEMO) yang mencerminkan struktur presensi digital
 * harian, rekapitulasi, dan log audit di SMA BPI 1 Bandung.
 */

export type StudentAttendanceStatus = "hadir" | "sakit" | "izin" | "alpa" | "terlambat";
export type TeacherAttendanceStatus = "hadir" | "sakit" | "izin" | "dinas" | "alpa" | "terlambat";

export interface StudentAttendanceItem {
  id: string;
  studentId: string;
  nis: string;
  nisn: string;
  fullName: string;
  gender: "L" | "P";
  className: string;
  date: string;
  status: StudentAttendanceStatus;
  checkInTime: string | null;
  notes?: string;
  recordedBy: string;
  recordedAt: string;
}

export interface TeacherAttendanceItem {
  id: string;
  teacherId: string;
  nip?: string;
  nuptk?: string;
  fullName: string;
  gender: "L" | "P";
  primarySubject: string;
  date: string;
  status: TeacherAttendanceStatus;
  checkInTime: string | null;
  notes?: string;
  teachingHoursToday: number;
  dutyAssignment?: string;
  recordedBy: string;
  recordedAt: string;
}

export interface ClassAttendanceSummary {
  classId: string;
  className: string;
  gradeLevel: "X" | "XI" | "XII";
  homeroomTeacher: string;
  totalStudents: number;
  present: number;
  sick: number;
  permission: number;
  absent: number;
  late: number;
  attendanceRate: number; // Persentase (e.g. 97.2)
  statusSubmission: "Sudah Direkap" | "Belum Lengkap" | "Menunggu Rekap";
  lastUpdated: string;
}

export interface AttendanceAuditLog {
  id: string;
  timestamp: string;
  category: "Presensi Siswa" | "Presensi Guru" | "Koreksi Data" | "Surat Izin";
  targetDescription: string;
  action: string;
  operatorName: string;
  operatorRole: string;
  status: "Terverifikasi" | "Tercatat";
}

// Data presensi awal siswa hari ini
export const initialMockStudentAttendance: StudentAttendanceItem[] = [
  {
    id: "att-std-001",
    studentId: "std-001",
    nis: "242510001",
    nisn: "0078912301",
    fullName: "Andi Pratama",
    gender: "L",
    className: "X-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:42 WIB",
    notes: "Tepat waktu (Fingerprint Gedung A)",
    recordedBy: "Drs. H. Mulyadi (Wali Kelas)",
    recordedAt: "06:42:15",
  },
  {
    id: "att-std-002",
    studentId: "std-002",
    nis: "242510002",
    nisn: "0078912302",
    fullName: "Bunga Cahyani",
    gender: "P",
    className: "X-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:48 WIB",
    notes: "Tepat waktu",
    recordedBy: "Drs. H. Mulyadi (Wali Kelas)",
    recordedAt: "06:48:30",
  },
  {
    id: "att-std-003",
    studentId: "std-003",
    nis: "242510003",
    nisn: "0078912303",
    fullName: "Rizky Maulana",
    gender: "L",
    className: "X-1",
    date: "2026-09-22",
    status: "sakit",
    checkInTime: null,
    notes: "Sakit demam, surat dokter dari RS Muhammadiyah terlampir",
    recordedBy: "Drs. H. Mulyadi (Wali Kelas)",
    recordedAt: "07:15:00",
  },
  {
    id: "att-std-004",
    studentId: "std-004",
    nis: "242510004",
    nisn: "0078912304",
    fullName: "Siti Aisyah",
    gender: "P",
    className: "X-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:35 WIB",
    notes: "Tepat waktu",
    recordedBy: "Drs. H. Mulyadi (Wali Kelas)",
    recordedAt: "06:35:10",
  },
  {
    id: "att-std-005",
    studentId: "std-005",
    nis: "242510005",
    nisn: "0078912305",
    fullName: "Fahri Ramadhan",
    gender: "L",
    className: "X-1",
    date: "2026-09-22",
    status: "terlambat",
    checkInTime: "07:12 WIB",
    notes: "Terlambat 12 menit karena kemacetan Jl. Buah Batu",
    recordedBy: "Guru Piket Pagi",
    recordedAt: "07:12:45",
  },
  {
    id: "att-std-006",
    studentId: "std-006",
    nis: "232410020",
    nisn: "0068714520",
    fullName: "Dimas Arya Wijaya",
    gender: "L",
    className: "XI-MIPA-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:38 WIB",
    notes: "Tepat waktu",
    recordedBy: "Dr. Hj. Nurjanah (Wali Kelas)",
    recordedAt: "06:38:00",
  },
  {
    id: "att-std-007",
    studentId: "std-007",
    nis: "232410021",
    nisn: "0068714521",
    fullName: "Annisa Permata Sari",
    gender: "P",
    className: "XI-MIPA-1",
    date: "2026-09-22",
    status: "izin",
    checkInTime: null,
    notes: "Izin menghadiri olimpiade sains tingkat provinsi",
    recordedBy: "Dr. Hj. Nurjanah (Wali Kelas)",
    recordedAt: "07:05:00",
  },
  {
    id: "att-std-008",
    studentId: "std-008",
    nis: "232410045",
    nisn: "0068714545",
    fullName: "Christian Jonathan",
    gender: "L",
    className: "XI-IPS-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:45 WIB",
    notes: "Tepat waktu",
    recordedBy: "Rudi Hartono (Wali Kelas)",
    recordedAt: "06:45:12",
  },
  {
    id: "att-std-009",
    studentId: "std-009",
    nis: "232410046",
    nisn: "0068714546",
    fullName: "Dewi Sekar Kinanti",
    gender: "P",
    className: "XI-IPS-1",
    date: "2026-09-22",
    status: "alpa",
    checkInTime: null,
    notes: "Tanpa keterangan hingga pukul 08.00 WIB (Wali murid telah dihubungi)",
    recordedBy: "Rudi Hartono (Wali Kelas)",
    recordedAt: "08:00:20",
  },
  {
    id: "att-std-010",
    studentId: "std-010",
    nis: "222310080",
    nisn: "0058619980",
    fullName: "Muhammad Farhan Al-Ghifari",
    gender: "L",
    className: "XII-MIPA-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:30 WIB",
    notes: "Tepat waktu",
    recordedBy: "Iwan Setiawan (Wali Kelas)",
    recordedAt: "06:30:45",
  },
  {
    id: "att-std-011",
    studentId: "std-011",
    nis: "222310081",
    nisn: "0058619981",
    fullName: "Zahra Salsabila Putri",
    gender: "P",
    className: "XII-MIPA-1",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:40 WIB",
    notes: "Tepat waktu",
    recordedBy: "Iwan Setiawan (Wali Kelas)",
    recordedAt: "06:40:10",
  },
  {
    id: "att-std-012",
    studentId: "std-012",
    nis: "222310099",
    nisn: "0058619999",
    fullName: "Reza Rahardian Nugraha",
    gender: "L",
    className: "XII-IPS-2",
    date: "2026-09-22",
    status: "sakit",
    checkInTime: null,
    notes: "Sakit flu (Keterangan orang tua via WhatsApp)",
    recordedBy: "Hj. Euis Maryati (Wali Kelas)",
    recordedAt: "07:20:00",
  },
];

// Data presensi awal guru hari ini
export const initialMockTeacherAttendance: TeacherAttendanceItem[] = [
  {
    id: "att-tch-001",
    teacherId: "tch-001",
    nip: "197205121998021002",
    fullName: "Drs. H. Mulyadi, M.Pd.",
    gender: "L",
    primarySubject: "Matematika",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:25 WIB",
    notes: "Tepat waktu - Mengajar Jam 1-4 (Kelas X-1, X-2)",
    teachingHoursToday: 4,
    recordedBy: "Sistem Presensi RFID",
    recordedAt: "06:25:30",
  },
  {
    id: "att-tch-002",
    teacherId: "tch-002",
    nip: "197508202000032001",
    fullName: "Dra. Hj. Siti Rohmah, M.Si.",
    gender: "P",
    primarySubject: "Biologi",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:30 WIB",
    notes: "Tepat waktu - Praktikum Laboratorium IPA Jam 3-6",
    teachingHoursToday: 4,
    recordedBy: "Sistem Presensi RFID",
    recordedAt: "06:30:15",
  },
  {
    id: "att-tch-003",
    teacherId: "tch-003",
    nip: "198304152009011004",
    fullName: "Agus Supriatna, S.Pd.",
    gender: "L",
    primarySubject: "Bahasa Indonesia",
    date: "2026-09-22",
    status: "dinas",
    checkInTime: null,
    notes: "Dinas Luar: Narasumber Workshop Kurikulum di Disdik Jabar",
    teachingHoursToday: 0,
    dutyAssignment: "Surat Tugas No. 421/108-BPI/2026",
    recordedBy: "Wakasek Kurikulum",
    recordedAt: "07:00:00",
  },
  {
    id: "att-tch-004",
    teacherId: "tch-004",
    nip: "196911021995122001",
    fullName: "Dr. Hj. Nurjanah, M.Pd.",
    gender: "P",
    primarySubject: "Fisika",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:20 WIB",
    notes: "Tepat waktu - Mengajar Kelas XI-MIPA",
    teachingHoursToday: 6,
    recordedBy: "Sistem Presensi RFID",
    recordedAt: "06:20:10",
  },
  {
    id: "att-tch-005",
    teacherId: "tch-005",
    nip: "198709182011011005",
    fullName: "Rudi Hartono, M.Pd.",
    gender: "L",
    primarySubject: "Sosiologi",
    date: "2026-09-22",
    status: "izin",
    checkInTime: null,
    notes: "Izin keperluan keluarga mendesak (Tugas mandiri diberikan)",
    teachingHoursToday: 2,
    recordedBy: "Staf Tata Usaha Kepegawaian",
    recordedAt: "06:50:00",
  },
  {
    id: "att-tch-006",
    teacherId: "tch-006",
    nip: "197803222005011003",
    fullName: "Iwan Setiawan, S.Si., M.Pd.",
    gender: "L",
    primarySubject: "Kimia",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:35 WIB",
    notes: "Tepat waktu - Mengajar Kelas XII-MIPA",
    teachingHoursToday: 4,
    recordedBy: "Sistem Presensi RFID",
    recordedAt: "06:35:45",
  },
  {
    id: "att-tch-007",
    teacherId: "tch-007",
    nip: "198006152008012006",
    fullName: "Hj. Euis Maryati, S.Pd.",
    gender: "P",
    primarySubject: "Ekonomi",
    date: "2026-09-22",
    status: "hadir",
    checkInTime: "06:40 WIB",
    notes: "Tepat waktu",
    teachingHoursToday: 4,
    recordedBy: "Sistem Presensi RFID",
    recordedAt: "06:40:00",
  },
  {
    id: "att-tch-008",
    teacherId: "tch-008",
    nuptk: "8765769671100092",
    fullName: "Taufik Hidayat, S.Pd., M.A.",
    gender: "L",
    primarySubject: "Bahasa Inggris",
    date: "2026-09-22",
    status: "terlambat",
    checkInTime: "07:15 WIB",
    notes: "Terlambat 15 menit, mengajar jam ke-3",
    teachingHoursToday: 2,
    recordedBy: "Guru Piket",
    recordedAt: "07:15:30",
  },
];

// Rekapitulasi presensi per rombel kelas hari ini
export const mockClassAttendanceSummaries: ClassAttendanceSummary[] = [
  {
    classId: "cls-x-1",
    className: "X-1",
    gradeLevel: "X",
    homeroomTeacher: "Drs. H. Mulyadi, M.Pd.",
    totalStudents: 36,
    present: 34,
    sick: 1,
    permission: 0,
    absent: 0,
    late: 1,
    attendanceRate: 97.2,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:15 WIB",
  },
  {
    classId: "cls-x-2",
    className: "X-2",
    gradeLevel: "X",
    homeroomTeacher: "Dra. Hj. Siti Rohmah, M.Si.",
    totalStudents: 36,
    present: 35,
    sick: 1,
    permission: 0,
    absent: 0,
    late: 0,
    attendanceRate: 97.2,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:20 WIB",
  },
  {
    classId: "cls-x-3",
    className: "X-3",
    gradeLevel: "X",
    homeroomTeacher: "Agus Supriatna, S.Pd.",
    totalStudents: 35,
    present: 33,
    sick: 0,
    permission: 1,
    absent: 1,
    late: 0,
    attendanceRate: 94.3,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:25 WIB",
  },
  {
    classId: "cls-xi-mipa-1",
    className: "XI-MIPA-1",
    gradeLevel: "XI",
    homeroomTeacher: "Dr. Hj. Nurjanah, M.Pd.",
    totalStudents: 36,
    present: 35,
    sick: 0,
    permission: 1,
    absent: 0,
    late: 0,
    attendanceRate: 97.2,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:10 WIB",
  },
  {
    classId: "cls-xi-ips-1",
    className: "XI-IPS-1",
    gradeLevel: "XI",
    homeroomTeacher: "Rudi Hartono, M.Pd.",
    totalStudents: 34,
    present: 32,
    sick: 0,
    permission: 1,
    absent: 1,
    late: 0,
    attendanceRate: 94.1,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:30 WIB",
  },
  {
    classId: "cls-xii-mipa-1",
    className: "XII-MIPA-1",
    gradeLevel: "XII",
    homeroomTeacher: "Iwan Setiawan, S.Si., M.Pd.",
    totalStudents: 35,
    present: 35,
    sick: 0,
    permission: 0,
    absent: 0,
    late: 0,
    attendanceRate: 100.0,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:05 WIB",
  },
  {
    classId: "cls-xii-ips-2",
    className: "XII-IPS-2",
    gradeLevel: "XII",
    homeroomTeacher: "Hj. Euis Maryati, S.Pd.",
    totalStudents: 34,
    present: 32,
    sick: 2,
    permission: 0,
    absent: 0,
    late: 0,
    attendanceRate: 94.1,
    statusSubmission: "Sudah Direkap",
    lastUpdated: "07:35 WIB",
  },
];

// Riwayat audit pencatatan presensi
export const mockAttendanceAuditLogs: AttendanceAuditLog[] = [
  {
    id: "log-001",
    timestamp: "2026-09-22 08:00:20",
    category: "Presensi Siswa",
    targetDescription: "Pencatatan Presensi Kelas XI-IPS-1 (32 Hadir, 1 Izin, 1 Alpa)",
    action: "Finalisasi Rekap Harian",
    operatorName: "Rudi Hartono, M.Pd.",
    operatorRole: "Wali Kelas XI-IPS-1",
    status: "Terverifikasi",
  },
  {
    id: "log-002",
    timestamp: "2026-09-22 07:35:10",
    category: "Presensi Siswa",
    targetDescription: "Pencatatan Presensi Kelas XII-IPS-2 (32 Hadir, 2 Sakit)",
    action: "Finalisasi Rekap Harian",
    operatorName: "Hj. Euis Maryati, S.Pd.",
    operatorRole: "Wali Kelas XII-IPS-2",
    status: "Terverifikasi",
  },
  {
    id: "log-003",
    timestamp: "2026-09-22 07:15:45",
    category: "Presensi Siswa",
    targetDescription: "Siswa Terlambat: Fahri Ramadhan (X-1) - Masuk 07:12 WIB",
    action: "Input Catatan Keterlambatan",
    operatorName: "Drs. H. Mulyadi",
    operatorRole: "Guru Piket Pagi",
    status: "Terverifikasi",
  },
  {
    id: "log-004",
    timestamp: "2026-09-22 07:05:00",
    category: "Presensi Guru",
    targetDescription: "Surat Tugas Dinas Luar: Agus Supriatna, S.Pd. (Disdik Jabar)",
    action: "Pengesahan Izin Dinas",
    operatorName: "Dr. Hj. Nurjanah, M.Pd.",
    operatorRole: "Wakasek Kurikulum",
    status: "Terverifikasi",
  },
  {
    id: "log-005",
    timestamp: "2026-09-22 06:45:00",
    category: "Presensi Siswa",
    targetDescription: "Presensi Massal Fingerprint Pagi Gerbang Utama (1.180 siswa)",
    action: "Sinkronisasi Otomatis Mesin Absensi",
    operatorName: "Sistem RFID Gerbang",
    operatorRole: "Sistem Otomatis",
    status: "Tercatat",
  },
];
