import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 交易记录
 */
@Entity('t_operation_trade_record')
export class OperationTradeRecordEntity extends BaseEntity {
  @Index()
  @Column({ comment: '交易时间', nullable: true })
  transactionTime: Date;

  @Column({ comment: '交易类型', nullable: true })
  transactionType: string;

  @Index()
  @Column({ comment: '交易对方', nullable: true })
  opponent: string;

  @Index()
  @Column({ comment: '商品名称', nullable: true })
  goodsName: string;

  @Column({ comment: '收支类型', dict: ['收入', '支出', '其他'], default: '收入' })
  incomeType: string;

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

  @Column({ comment: '支付方式', nullable: true })
  payMethod: string;

  @Column({ comment: '当前状态', nullable: true })
  status: string;

  @Index()
  @Column({ comment: '交易单号', length: 100, nullable: true })
  transactionNo: string;

  @Index()
  @Column({ comment: '商户单号', length: 100, nullable: true })
  merchantNo: string;

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

  @Column({ comment: '所属部门' })
  departmentId: number;

  departmentName: string;

  @Column({ comment: '原始文件路径', length: 500 })
  filepath: string;
  
}