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

/**
 * 字典信息
 */
@Entity('dj_refund')
export class RefundEntity extends BaseEntity {
  @Column({ comment: '订单号' })
  orderNo: string;

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

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

  @Index({ unique: true })
  @Column({ comment: '退款订单号'})
  refundNo: string;

  @Column({ comment: '退款交易号'})
  refundTraceNo: string;

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

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

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

  @Column({ comment: '手续费', type: 'decimal', precision: 10, scale: 2 })
  charge: number;
  
  @Column({ comment: '货币单位' })
  currency: string;

  @Column({ comment: '退款原因', nullable: true })
  reson: string;

  @Column({ comment: '退款时间', nullable: true })
  date: Date;

  @Column({
    comment: '订单状态 0-退款中 1 退款成功 2 退款失败',
    type: 'tinyint',
    default: 0,
  })
  status: number;

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