import { BaseEntity } from '@cool-midway/core';
import { Column, Entity, Index } from 'typeorm';

/**
 * 字典信息
 */
@Entity('dj_withdraw')
export class WithdrawEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '订单号' })
  orderNo: string;

  @Index({ unique: true })
  @Column({ comment: '商户订单号' })
  outOrderNo: string;

  @Column({ comment: '交易号', nullable: true })
  traceNo: string;

  @Column({ comment: '通道码' })
  code: string;

  @Column({ comment: '商户号' })
  mchId: string;

  @Column({ comment: '金额', type: 'decimal', precision: 10, scale: 2 })
  amount: number;

  @Column({ comment: '货币单位' })
  currency: string;

  @Column({ comment: '用户证件信息' })
  personIdType: string;

  @Column({ comment: '用户证件ID' })
  personId: string;

  @Column({ comment: '用户姓名' })
  personName: string;

  @Column({ comment: '银行账号' })
  accountNo: string;

  @Column({ comment: '银行编码' })
  bankCode: string;

  @Column({ comment: '银行名称' })
  bankName: string;

  @Column({ comment: '通道手续费', type: 'decimal', precision: 10, scale: 2 })
  channelCharge: number;

  @Column({ comment: '手续费', type: 'decimal', precision: 10, scale: 2 })
  charge: number;
  
  @Column({
    comment: '订单状态 1-已受理 2-银行处理中 3-失败 8-成功',
    type: 'tinyint',
    default: 0,
  })
  status: number;

  @Column({ comment: '通知地址', length: 1000, nullable: true })
  notifyUrl: string;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
