import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNumber, IsEnum, IsOptional, IsDate } from 'class-validator';
import { PaymentType } from './PaymentType';
import { PayerType } from './PayerType';
import { PaymentStatus } from './PaymentStatus';

export class PaymentDTO {
  @ApiProperty()
  @IsString()
  id: string;

  @ApiProperty({ enum: PaymentType })
  @IsEnum(PaymentType)
  type: PaymentType;

  @ApiProperty()
  @IsNumber()
  amount: number;

  @ApiProperty()
  @IsNumber()
  platformFee: number;

  @ApiProperty()
  @IsNumber()
  netAmount: number;

  @ApiProperty()
  @IsString()
  payerId: string;

  @ApiProperty({ enum: PayerType })
  @IsEnum(PayerType)
  payerType: PayerType;

  @ApiProperty()
  @IsString()
  leagueId: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  seasonId?: string;

  @ApiProperty({ enum: PaymentStatus })
  @IsEnum(PaymentStatus)
  status: PaymentStatus;

  @ApiProperty()
  @IsDate()
  createdAt: Date;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsDate()
  completedAt?: Date;
}