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

export interface SubjectItem {
  code: string;
  name: string;
}

export interface ExamItem {
  id: number;
  name: string;
  mode: string;
  enable: boolean;
  schoolName: string;
  updateTime: number;
}

export type ExamListParams = PageParams<{ enable: boolean }>;
export type ExamListResult = PageResult<ExamItem>;

export interface UploadSheetParams {
  paperId: number;
  pageIndex: number;
  file: File;
  md5: string;
}
export interface UploadSliceParams extends UploadSheetParams {
  index: number;
}

export interface UploadFileResult {
  uri: string;
  updateTime: number;
}

// base config
export interface ConfigInfo {
  examId: number;
  paperTypeBarcodeContent: string[];
  imageCheckRatio: string | number;
  imageCheckOrder: string;
  enableSyncVerify: boolean;
  scannerAssignedMaxCount: string | number;
  scannerAssignedVerifyPassword: string;
}

export interface CardInfoParams {
  examId: number;
  number: number;
}

export interface CardInfoResult {
  number: number;
  code: string;
  // 若是通卡则为空，单一卡对应一个科目，混扫对应多个科目
  subjectList: Array<{
    subjectCode: string;
    subjectName: string;
  }>;
  //预留字段
  parameter: string | null;
  remark: string;
  //是否单页模式
  singlePage: boolean;
  //总张数
  paperCount: number;
  //卡格式来源，CLIENT表示本地程序制作，WEB表示在线工具制作
  source: "CLIENT" | "WEB";
  //是否需要本地适配，目前只有WEB来源的强制需要适配
  needAdapte: boolean;
  uri: string;
  md5: string;
  dpi: number;
  updateTime: number;
  adapteFile: Array<{
    device: string;
    role: string;
    uri: string;
    md5: string;
    dpi: string;
  }>;
}

export interface CardPage {
  exchange: {
    // 裁切图信息
    answer_area: Array<{
      area: [number, number, number, number];
      main_number: number;
      sub_number: string;
    }>;
  };
}

export interface CardContent {
  pages: CardPage[];
}
