export type AttendanceStatus = "present" | "absent" | "late" | "early_leave" | "excused"

export interface AttendanceRecord {
  id: string
  studentId: string
  classId: string
  scheduleId: string | null
  date: string
  status: AttendanceStatus
  remark: string | null
  recordedBy: string
  createdAt: string
  updatedAt: string
}

export interface AttendanceListItem {
  id: string
  studentId: string
  studentName: string
  classId: string
  className: string
  scheduleId: string | null
  date: string
  status: AttendanceStatus
  remark: string | null
  recordedBy: string
  recorderName: string
  createdAt: string
}

export interface AttendanceStats {
  total: number
  present: number
  absent: number
  late: number
  earlyLeave: number
  excused: number
  presentRate: number
  lateRate: number
}

export interface StudentAttendanceSummary {
  studentId: string
  studentName: string
  stats: AttendanceStats
  recentRecords: AttendanceListItem[]
}

export interface ClassAttendanceSummary {
  classId: string
  className: string
  date: string
  stats: AttendanceStats
  studentRecords: AttendanceListItem[]
}

export interface AttendanceRule {
  id: string
  classId: string | null
  lateThresholdMinutes: number | null
  earlyLeaveThresholdMinutes: number | null
  enableAutoMark: boolean | null
  createdAt: string
  updatedAt: string
}

export interface AttendanceQueryParams {
  classId?: string
  studentId?: string
  date?: string
  startDate?: string
  endDate?: string
  status?: AttendanceStatus
  page?: number
  pageSize?: number
}

export interface PaginatedAttendanceResult {
  items: AttendanceListItem[]
  total: number
  page: number
  pageSize: number
  totalPages: number
}

/**
 * 注意：状态标签与颜色映射已迁移至 `./constants.ts`，
 * 使用 i18n key（`status.*`）+ Badge variant，由组件层通过 `useTranslations("attendance")` 解析。
 */
