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

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

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

  @ApiProperty({ example: '50.00', description: 'Refund amount' })
  @IsNumberString()
  amount: string;

  @ApiProperty({ example: 'Product defective', description: 'Reason for refund' })
  @IsString()
  @MaxLength(200)
  reason: string;
}

export class ApproveRefundDto {
  @ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440003', description: 'Admin user ID who approves the refund' })
  @IsUUID()
  processedBy: string;
}

export class ListRefundsQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({
    enum: RefundStatus,
    description: 'Filter by refund status',
  })
  @IsOptional()
  @IsEnum(RefundStatus)
  status?: RefundStatus;
}
