import { PageResult, PageParams } from './common';

export interface OptionItem {
  id: number;
  name: string;
}

export interface AgentQueryParam {
  id: number; // teachingId
  flag?: boolean;
}
export interface RoomQueryParam {
  examSiteId: number;
}

export interface TaskListFilter {
  name: string;
}
export type TaskListPageParam = PageParams<TaskListFilter>;

export interface TaskItem {
  id: number;
  name: string;
  selfApplyStartTime: number;
  selfApplyEndTime: number;
  openApplyStartTime: number;
  openApplyEndTime: number;
  enable: number; // 1:启用；0:禁用
  updateTime: number;
}

export type TaskListPageRes = PageResult<TaskItem>;

export interface TaskItemDetail {
  id: number;
  name: string;
  allowApplyDays: number;
  allowApplyCancelDays: number;
  selfApplyStartTime: number;
  selfApplyEndTime: number;
  openApplyStartTime: number;
  openApplyEndTime: number;
  timeList: Array<{
    id: number | null;
    startTime: number | undefined;
    endTime: number | undefined;
  }>;
  notice: string;
}

export interface TaskRuleUpdateParams {
  id: number | null;
  name: string;
  allowApplyCancelDays: number;
  selfApplyStartTime: number | undefined;
  selfApplyEndTime: number | undefined;
  openApplyStartTime: number | undefined;
  openApplyEndTime: number | undefined;
  enable: boolean;
}

export interface TaskTimeUpdateParams {
  id: number;
  timeJson: string;
}

export interface TaskNoticeUpdateParams {
  id: number;
  notice: string;
}

export interface OrderRecordItem {
  id: number;
  name: string;
  identityNumber: string;
  studentCode: string;
  teachingName: string; // 教学点
  agentName: string; // 考点
  roomName: string; // 考场
  seatNumber: string; // 座位号
  cancel: boolean; // 是否取消
  endTime: number;
  startTime: number;
  updateTime: number; // 操作时间
  userName: string; // 操作人
}
export type OrderRecordListPageRes = PageResult<OrderRecordItem>;
export interface OrderRecordListFilter {
  taskId: number | null;
  teachingId: number | null;
  agentId: number | null;
  name: string;
  identityNumber: string;
  studentCode: string;
  startDate: number | undefined;
  endDate: number | undefined;
}
export type OrderRecordListPageParam = PageParams<OrderRecordListFilter>;

export interface StudentExportItem {
  id: number;
  name: string;
  fileName: string;
  status: string;
  message: string | null;
  uploadTime: number;
}

export type StudentExportListPageRes = PageResult<StudentExportItem>;

export interface OrderRecordPrintTimeItem {
  examDate: number;
}

export interface OrderRecordPrintParam {
  teachingId: number | null;
  agentId: number | null;
  examDate: number | undefined;
}
export interface ExportOrderRecordDetailParam {
  teachingId: number | null;
}

export interface TimePeriodItem {
  id: number; // 注意：教学点管理员第一次设置和学校管理员新增了时段的情况下为空
  timePeriodId: number;
  timePeriodStr: string; // 如:08:00-09:30,作用：和原型中第一行做比较
  enable: boolean; // false:关闭,true:开启
  editable: boolean; // false:不可编辑，true:可编辑
}
export interface OrderPeriodSetItem {
  dateStr: string;
  timePeriodList: TimePeriodItem[];
  batchStatus?: boolean; // false:未批量设置，true:已批量设置
}
