export type ElectiveCourseStatus = "draft" | "open" | "closed" | "cancelled"

export type ElectiveSelectionMode = "fcfs" | "lottery"

export type CourseSelectionStatus =
  | "selected"
  | "enrolled"
  | "waitlist"
  | "dropped"
  | "rejected"

export interface ElectiveCourse {
  id: string
  name: string
  subjectId: string | null
  teacherId: string
  gradeId: string | null
  description: string | null
  capacity: number
  enrolledCount: number
  classroom: string | null
  schedule: string | null
  startDate: string | null
  endDate: string | null
  selectionStartAt: string | null
  selectionEndAt: string | null
  /** 退课截止时间（P2-4 新增）：ISO 字符串，为 null 表示不限制 */
  dropDeadline: string | null
  status: ElectiveCourseStatus
  selectionMode: ElectiveSelectionMode
  credit: string
  createdAt: string
  updatedAt: string
}

export interface ElectiveCourseWithDetails extends ElectiveCourse {
  teacherName: string | null
  subjectName: string | null
  gradeName: string | null
}

export interface CourseSelection {
  id: string
  courseId: string
  studentId: string
  status: CourseSelectionStatus
  priority: number | null
  selectedAt: string
  enrolledAt: string | null
  droppedAt: string | null
  /** 退课理由（P2-4 新增）：学生退课时可选填写 */
  dropReason: string | null
  lotteryRank: number | null
  createdAt: string
  updatedAt: string
}

export interface CourseSelectionWithDetails extends CourseSelection {
  courseName: string | null
  studentName: string | null
  courseCapacity: number | null
  courseEnrolledCount: number | null
  courseStatus: ElectiveCourseStatus | null
}

export interface GetElectiveCoursesParams {
  status?: ElectiveCourseStatus
  gradeId?: string
  subjectId?: string
  teacherId?: string
}

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