import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
import { PaymentMethodEntity } from '../../domain/entities/payment-method.entity';
import { PaymentMethodType } from '../../constants';
import { ApiProperty } from '@nestjs/swagger';
import { IsString, ValidateIf } from 'class-validator';

export class PaymentMethodDto
  extends BaseStatusDto
  implements PaymentMethodEntity
{
  @ApiProperty({
    type: String,
    required: true,
    example: PaymentMethodType.TRANSFER_BANK,
  })
  @IsString()
  type: PaymentMethodType;

  @ApiProperty({
    type: String,
    required: true,
    example: 'BCA',
  })
  @IsString()
  issuer_name: string;

  @ApiProperty({
    type: String,
    required: false,
    example: '1232334235',
  })
  @IsString()
  @ValidateIf((body) => body.account_number)
  account_number: string;

  @ApiProperty({
    type: String,
    required: false,
    example: 'Skyworld',
  })
  @IsString()
  @ValidateIf((body) => body.account_name)
  account_name: string;

  @ApiProperty({
    type: String,
    required: false,
    example: '...',
  })
  @IsString()
  @ValidateIf((body) => body.qr_image)
  qr_image: string;

  @ApiProperty({
    type: String,
    required: false,
    example: 'gate 1',
  })
  @IsString()
  @ValidateIf((body) => body.note)
  note: string;
}
