import { DictItem, Study } from "@/types/index";
import { University } from "@/types/university";

export type EnumInputType = 'Score' | 'Number' | 'Text' | 'Radio' | 'Picker' | 'Checkbox' | 'Eyesight';
export type EnumRuleCategory = 'Enroll' | 'Special';
export type EnumPickType = 'Danger' | 'Normal' | 'Safety';

export interface EnrollRuleItem {
  defaultValue?: string | number;
  description?: string;
  dictOptions?: DictItem[];
  dotDisable?: boolean
  enumInputType: EnumInputType;
  enumRuleCategory: EnumRuleCategory;
  fieldName: string;
  keyboardMode?: string
  label: string;
  max?: number
  min?: number
  mutexOption?: string[] | number[];
  options?: string[] | number[];
  placeholder?: string;
  regex?: string;
  required?: boolean;
  tips?: string;
  readonly?: boolean;
}

export interface EnrollRule {
  category: string;
  content: string;
  details: EnrollRuleItem[]
}

export interface VoluntaryModel extends Record<string, string | number | null> {

}

export interface VoluntaryResultHistory {
  "year": string | number;
  "score": string | number | null; // 最低分
  "plan"?: number | null; // 计划人数
  "enroll"?: number | null; // 录取人数
  "diff"?: number | null; // 负表示低于录取分；正数表示高于录取分
  "ruleContent"?: string; // 招录规则
  "application"?: number | null; // 报名人数比值
  "admission"?: number | null; // 计划人数比值
}

export interface VoluntaryResultSkill {
  year: string | number;
  cultureScore: number;
  cultureRule: string;
  enrollScore: number;
  skillScore: number; // 反向测技能分
  diff: number; // 负数表示低于skillScore，正数高于
}

export interface VoluntaryResult {
  "universityCode": string;
  "majorCode": string;
  "majorEnrollCode": string;
  "majorGroup": string;
  "majorName": string;
  "majorDirection": string;
  "enumPickType": EnumPickType;
  "enrollRate": number | null;
  "enrollRateText": string;
  "tips": string | null;
  "histories"?: VoluntaryResultHistory[],
  "skill": VoluntaryResultSkill
}

export interface SelectedUniversityMajor extends Study.SelectedUniversityMajor {
  info?: University;
}

export interface VoluntaryDto {
  target: SelectedUniversityMajor;
  rules: EnrollRule[];
  model: VoluntaryModel;
  result: VoluntaryResult;
}

export interface VoluntaryScoreItem {
  label: string;
  score: number;
  total: number;
  labelWidth?: string;
  scoreWidth?: string;
}

export interface VoluntaryMajorItem {
  majorId: string;
  majorName: string;
  majorAncestors: string;
  majorGroup: string;
}

export interface VoluntaryRecord {
  id: number;
  universityLogo: string;
  universityId: string;
  universityName: string;
  majors: VoluntaryMajorItem[]
}