import { IsString, IsUUID, IsNumberString, IsOptional, IsEnum } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { SettlementStatus } from '../../../domain/entities/settlement.entity';
import { PaginationQueryDto } from './pagination.dto';

export class CreateSettlementDto {
  @ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440000', description: 'Trade ID' })
  @IsUUID()
  tradeId: string;

  @ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440001', description: 'Buyer user ID' })
  @IsUUID()
  buyerId: string;

  @ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440002', description: 'Seller user ID' })
  @IsUUID()
  sellerId: string;

  @ApiProperty({ example: '100.00', description: 'Settlement amount' })
  @IsNumberString()
  amount: string;

  @ApiProperty({ example: '1.50', description: 'Buyer fee amount' })
  @IsNumberString()
  buyerFee: string;

  @ApiProperty({ example: '1.50', description: 'Seller fee amount' })
  @IsNumberString()
  sellerFee: string;
}

export class ListSettlementsQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({
    enum: SettlementStatus,
    description: 'Filter by settlement status',
  })
  @IsOptional()
  @IsEnum(SettlementStatus)
  status?: SettlementStatus;
}
