import { DeclarationType, OrderStatus, OrderType, ProductSpecId, ProductType } from '@/constants/product';

export interface DeclarationTypeResult {
  type: DeclarationType;
  publisher: string;
  publisherAcctNo: string;
  addGroupQrCode: string;
}

export interface ProductInfo {
  productCode: ProductType;
  productId: ProductType;
  balance: number;
  created: number;
  updated: number;
  // 报单类型信息,只有 use 接口返回值才有
  declarationTypeResult?: DeclarationTypeResult;
}

export interface CustomerServiceInfo {
  id: string;
  robotId: string;
  robotImNick: string;
  robotImNo: string;
  avatar: string;
  vxQrCode: string;
}

export interface GetProductListRequest {
  userId: string;
}

export interface GetProductDetailRequest {
  userId: string;
  productCode: ProductType;
}

export interface GetProductIsUnlockRequest {
  userId: string;
  productCode: ProductType;
  // 通告id, productCode为 GETJOB 时必传
  jobId?: string;
  // 群id, productCode为 ADD_GROUP 时必传
  blGroupId?: string;
}

export interface GetProductIsUnlockResponse {
  userId: string;
  jobId: string;
  productId: string;
  useDate: string;
  useTime: string;
  declarationTypeResult?: DeclarationTypeResult;
}

export interface PostUseProductRequest {
  userId: string;
  productCode: ProductType;
  // 通告id, productCode为 GETJOB 时必传
  jobId?: string;
  // 群id, productCode为 ADD_GROUP 时必传
  blGroupId?: string;
}

export interface CreatePayOrderParams {
  appId: string;
  timeStamp: string;
  signType: 'MD5' | 'RSA' | 'HMAC-SHA256';
  nonceStr: string;
  packageVal: string;
  paySign: string;
}

export interface OrderInfo {
  payOrderNo: string;
  // 支付订单状态，0 待支付，1 已支付，2 已退款,3 已取消
  status: OrderStatus;
  payTime?: string;
  finishPayTime?: string;
}

export interface CreatePayInfoRequest {
  type: OrderType;
  userId: string;
  productCode: ProductType;
  productSpecId: ProductSpecId;
  /**
   * 业务id，比如jobId,groupId
   * 当type为1时，必须要传groupId
   */
  bizId?: string;
  // 应付金额,单位是分
  amt: number;
  // 支付渠道，1 微信支付
  payChannel: number;
  // 支付类型，1 小程序支付
  payType: number;
  mark?: string;
}

export interface CreatePayInfoResponse extends OrderInfo {
  createPayInfo: string; // CreatePayInfo stringify 后的结果
}

export interface GetOrderInfoRequest {
  payOrderNo: string;
  userId: string;
}
