export const contractTypeOptions = [
  { label: '报名/续费', value: 'ENROLL', elTagType: 'primary' },
  { label: '补购', value: 'ADDON', elTagType: 'success' },
  { label: '退费', value: 'REFUND', elTagType: 'danger' },
  { label: '转课', value: 'TRANSFER', elTagType: 'warning' }
];

export const contractCategoryOptions = [
  { label: '初中', value: 'JUNIOR' },
  { label: '高中', value: 'SENIOR' },
  { label: '大学', value: 'UNIVERSITY' },
  { label: '高端', value: 'PREMIUM' }
];

export const contractStatusOptions = [
  { label: '草稿', value: '0', elTagType: 'info' },
  { label: '待生效', value: '1', elTagType: 'warning' },
  { label: '执行中', value: '2', elTagType: 'success' },
  { label: '已结清', value: '3', elTagType: 'primary' },
  { label: '已退费', value: '4', elTagType: 'danger' },
  { label: '已转课', value: '5', elTagType: 'warning' },
  { label: '已作废', value: '9', elTagType: 'info' }
];

export const paymentStatusOptions = [
  { label: '未支付', value: '0', elTagType: 'info' },
  { label: '部分支付', value: '1', elTagType: 'warning' },
  { label: '已支付', value: '2', elTagType: 'success' },
  { label: '已退费', value: '3', elTagType: 'danger' }
];

export const paymentMethodOptions = [
  { label: '现金', value: 'CASH' },
  { label: '微信', value: 'WECHAT' },
  { label: '支付宝', value: 'ALIPAY' },
  { label: '银行卡', value: 'BANK' },
  { label: '信用卡', value: 'CARD' }
];

import type { PaymentPlanVO, PaymentPlanForm } from '@/api/edu/payment-plan/types';

export interface ContractPackageVO {
  id: number | string;
  contractId: number | string;
  packageId: number | string;
  packageName: string;
  packageType: string;
  totalHours: number;
  usedHours: number;
  remainHours: number;
  giftHours: number;
  listPrice: number;
  salePrice: number;
  discountAmount: number;
  finalAmount: number;
  strategyId: number | string;
  expireDate: string;
  status: string;
  remark: string;
}

export interface ContractPackageForm {
  id?: number | string;
  packageId: number | string;
  totalHours: number;
  giftHours: number;
  salePrice: number;
  discountAmount: number;
  finalAmount: number;
  expireDate: string;
  remark: string;
}

export interface ContractGiftForm {
  id?: number | string;
  giftType: string;
  giftHours: number;
  giftCount: number;
  reason: string;
  expireDate: string;
  remark: string;
}

export interface ContractVO extends BaseEntity {
  id: number | string;
  contractNo: string;
  studentId: number | string;
  contractType: string;
  contractCategory: string;
  selectedSubject: string;
  parentContractId: number | string;
  signDate: string;
  effectiveDate: string;
  expireDate: string;
  servicePeriodText: string;
  serviceContractName: string;
  totalAmount: number;
  discountAmount: number;
  paidAmount: number;
  refundAmount: number;
  totalHours: number;
  usedHours: number;
  remainHours: number;
  giftHours: number;
  paymentMethod: string;
  paymentReceivedDate: string;
  isInstallment: string;
  installmentSecond: number;
  installmentThird: number;
  actualTotalReceived: number;
  settlementDate: string;
  /** 签约负责人(姓名, 旧字段保留兼容) */
  signPerson: string;
  /** 签约负责人ID(edu_staff.id) */
  signUserId?: number | string;
  /** 课程顾问姓名(查询翻译填充) */
  salesName?: string;
  /** 管家姓名(查询翻译填充) */
  housekeeperName?: string;
  /** 签约负责人姓名(查询翻译填充) */
  signUserName?: string;
  contractRecovered: string;
  remittanceName: string;
  needInvoice: string;
  paymentStatus: string;
  status: string;
  salesId: number | string;
  housekeeperId: number | string;
  signLocation: string;
  signImageUrl: string;
  description: string;
  guardianName: string;
  guardianIdCard: string;
  guardianPhone: string;
  guardianEmail: string;
  homeAddress: string;
  applySchoolCount: number;
  applyRegionScope: string;
  interviewCamp: string;
  majorCamp: string;
  volunteerCamp: string;
  freshmanCamp: string;
  gviProject: string;
  researchProject: string;
  internshipProject: string;
  signedAt: string;
  activatedAt: string;
  finishedAt: string;
  remark: string;
  packages: ContractPackageVO[];
  gifts: any[];
  logs: any[];
  /** 里程碑列表(升学服务合同) */
  milestones?: any[];
  /** 缴费计划列表(分期合同) */
  paymentPlans?: PaymentPlanVO[];
}

export interface ContractForm {
  id: number | string | undefined;
  contractNo: string;
  studentId: number | string | undefined;
  contractType: string;
  contractCategory: string;
  selectedSubject: string;
  parentContractId: number | string | undefined;
  signDate: string;
  effectiveDate: string;
  expireDate: string;
  servicePeriodText: string;
  serviceContractName: string;
  paymentMethod: string;
  paymentReceivedDate: string;
  isInstallment: string;
  installmentSecond: number;
  installmentThird: number;
  /** 分期数 2 或 3 */
  installmentCount?: number;
  /** 缴费计划明细(分期时携带) */
  paymentPlans?: PaymentPlanForm[];
  /** 应收总额(前端汇总展示, 后端汇总覆盖) */
  totalAmount?: number;
  actualTotalReceived: number;
  settlementDate: string;
  /** 签约负责人(姓名, 旧字段保留兼容) */
  signPerson: string;
  /** 签约负责人ID(edu_staff.id) */
  signUserId?: number | string;
  /** 课程顾问姓名(查询翻译填充) */
  salesName?: string;
  /** 管家姓名(查询翻译填充) */
  housekeeperName?: string;
  /** 签约负责人姓名(查询翻译填充) */
  signUserName?: string;
  contractRecovered: string;
  remittanceName: string;
  needInvoice: string;
  salesId: number | string | undefined;
  housekeeperId: number | string | undefined;
  signLocation: string;
  signImageUrl: string;
  description: string;
  guardianName: string;
  guardianIdCard: string;
  guardianPhone: string;
  guardianEmail: string;
  homeAddress: string;
  applySchoolCount: number;
  applyRegionScope: string;
  interviewCamp: string;
  majorCamp: string;
  volunteerCamp: string;
  freshmanCamp: string;
  gviProject: string;
  researchProject: string;
  internshipProject: string;
  remark: string;
  packages: ContractPackageForm[];
  gifts: ContractGiftForm[];
}

export interface ContractQuery extends PageQuery {
  contractNo: string;
  studentId: number | string;
  contractType: string;
  status: string;
  salesId: number | string;
  housekeeperId: number | string;
}

export interface ContractActivateForm {
  id: number | string;
  paidAmount: number;
  paymentMethod: string;
  remark: string;
}

export interface ContractRefundForm {
  id: number | string;
  refundAmount: number;
  reason: string;
  attachments: string;
}

export interface ContractTransferForm {
  id: number | string;
  targetStudentId: number | string;
  reason: string;
}
