import { IsDateString, IsIn, IsNotEmpty, IsNumber, IsOptional, IsString, MaxLength, Min } from 'class-validator';

export class ApplyDiscountDto {
    @IsNotEmpty()
    @IsIn(['amount', 'percentage'])
    discountType: 'amount' | 'percentage';

    @IsNumber()
    @Min(0.01)
    discountValue: number;

    @IsOptional()
    @IsString()
    @MaxLength(500)
    discountReason?: string;

    @IsOptional()
    @IsDateString()
    discountValidUntil?: string;
}
