import { Expose, Transform } from 'class-transformer';
import { ProcessedByEntity } from './money-corp.entity';

/**
 * 결제 정보 Entity
 */
export class MoneyPaymentEntity {
  @Expose()
  mpyId!: number;

  @Expose()
  memId!: number;

  @Expose()
  mpyOrderNumber!: string;

  @Expose()
  mpyTid!: string | null;

  @Expose()
  mpyAmount!: number;

  @Expose()
  mpyMoney!: number;

  @Expose()
  mpyStatus!: string;

  @Expose()
  mpyCardType!: string | null;

  @Expose()
  mpyCardName!: string | null;

  @Expose()
  mpyCardNumber!: string | null;

  @Expose()
  mpyCanceledAmount!: number;

  @Expose()
  mpyCancelCount!: number;

  @Expose()
  mpyApprovedAt!: string | null;

  @Expose()
  mpyCanceledAt!: string | null;

  @Expose()
  mpyCreatedAt!: string;

  @Expose()
  mpyUpdatedAt!: string | null;

  // 조인된 데이터
  @Expose()
  memLoginId?: string;

  @Expose()
  @Transform(({ value }) => value || '')
  memName?: string;

  @Expose()
  memType?: string;

  @Expose()
  sagName?: string;

  @Expose()
  sacName?: string;

  @Expose()
  agcCorporateName?: string;
}

/**
 * 결제취소 이력 Entity
 */
export class MoneyPaymentCancelEntity {
  @Expose()
  mpcId!: number;

  @Expose()
  mpyId!: number;

  @Expose()
  mpcType!: string;

  @Expose()
  mpcAmount!: number;

  @Expose()
  mpcReason!: string | null;

  @Expose()
  mpcSequence!: number;

  @Expose()
  mpcCreatedAt!: string;

  // 조인된 데이터
  //* 결제취소 처리자 — 기업머니 이력과 같은 자리다(계획 M7 D1).
  @Expose()
  processedBy?: ProcessedByEntity;
}
