// API服务类型声明

// 接口类型定义
export interface ActivityInfo {
  activityName: string
  activityStartTime: string
  activityEndTime: string
  money: number
  status: number
}

export interface OcrUploadResponse {
  uploadId: string
}

export interface IdCardOcrParseResponse {
  raw: string
  words: string[]
  parsed: {
    birthday?: string
    id_number: string
    address: string
    image_status:
    | 'normal'
    | 'reversed_side'
    | 'non_idcard'
    | 'blurred'
    | 'other_type_card'
    | 'over_exposure'
    | 'over_dark'
    | 'unknown'
    risk_type:
    | 'normal'
    | 'copy'
    | 'scan'
    | 'temporary'
    | 'screen'
    | 'screenshot'
    | 'unknown'
    gender: '男' | '女' | '未知' | null | undefined
    name?: string
    nationality?: string
  }
}

export interface MarriageOcrParseResponse {
  raw: string
  words: string[]
  parsed: {
    marriageNo?: string
    registerDate?: string
    certificateHolder?: string
    wifeId?: string
    wifeName?: string
    wifeBirthDate?: string
    wifeNationality?: string
    wifeGender?: '男' | '女' | '未知' | null | undefined
    husbandId?: string
    husbandName?: string
    husbandGender?: '男' | '女' | '未知' | null | undefined
    husbandBirthDate?: string
    husbandNationality?: string
  }
}

export interface MarriageCodeDTO {
  marriageNo?: string
  receiveName?: string
  receiveMobile?: string
  code?: string
  smsCode?: string
  signImage?: string
  salesNo?: string
  dataTime?: string
}

export interface MarriageCodeVO {
  code: string
  status: number
  marriageNo: string | null
  receiveName: string | null
  receiveMobile: string | null
  receiveTime: string | null
  salesNo?: string
}

export interface MarriageCodeListVO {
  codeList: MarriageCodeVO[]
  receiveCount: string
  receiveAmount: string
}

export interface CommSmsDTO {
  mobile: string
  smsCode?: string
  type: 0 | 1 | 2 | 3 // 0=登录；1=兑换领取；2=OCR识别；3=本流程使用
}

// API服务接口定义
export interface ApiService {
  // 活动介绍页
  // 获取当前活动信息
  getCurrentActivity(): Promise<any>

  // OCR识别相关接口
  // 上传OCR图片
  uploadOcrImage(formData: FormData): Promise<any>

  // 发送短信验证码
  sendSms(data: CommSmsDTO): Promise<any>

  // OCR识别并返回证件信息
  marriageParseOcrInfo(data: {
    mobile: string
    smsCode: string
    uploadId: string
  }): Promise<any>

  // OCR 识别身份证
  idCardParseOcrInfo(data: {
    mobile: string
    smsCode: string
    uploadId: string
  }): Promise<any>

  // 领取流程相关接口
  // 领取前校验（生成二维码前的校验与预览）
  receiveCheck(data: MarriageCodeDTO): Promise<any>

  // 确认领取（落库并置为已核销）
  receiveCode(data: MarriageCodeDTO): Promise<any>

  // 二维码状态相关接口
  // 按站点号与月份分页统计列表
  getCodeList(data: {
    salesNo: string
    page: number
    size: number
    dataTime?: string
  }): Promise<any>

  // 按核销码查询状态
  getCodeStatus(data: { code: string }): Promise<any>

  // 兑奖页面相关接口
  // 根据核销码获取领取信息（用于自动带出）
  getCodeInfo(data: { code: string }): Promise<any>

  // 站点登录相关接口
  // 登录
  login(data: {
    mobile: string
    password?: string
    smsCode?: string
  }): Promise<any>

  // 后台活动管理接口（可选，用于管理端）
  // 获取活动列表
  getActivityList(): Promise<any>
}

export const apiService: ApiService
export default apiService
