import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsIn, IsNumber, IsOptional, IsString, Min } from 'class-validator';

export class GenerateInvoiceDto {
  @ApiPropertyOptional({ description: 'Create even when the calculated amount is zero.' })
  @IsOptional()
  @IsBoolean()
  confirmZero?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  performedBy?: string;

  @ApiPropertyOptional({ enum: ['ETB', 'USD'], description: 'Currency to bill the generated invoice in.' })
  @IsOptional()
  @IsIn(['ETB', 'USD'])
  billingCurrency?: 'ETB' | 'USD';
}

export class PayInvoiceBodyDto {
  @ApiPropertyOptional()
  @IsNumber()
  @Min(0.01)
  amount!: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  method?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  reference?: string;

  @ApiPropertyOptional({ description: 'Pickup driver name to notify after payment' })
  @IsOptional()
  @IsString()
  driverName?: string;

  @ApiPropertyOptional({ description: 'Pickup driver phone to notify after payment' })
  @IsOptional()
  @IsString()
  driverPhone?: string;
}
