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

export class UpdateInvoiceDto {
    @IsOptional()
    @IsNumber()
    @Min(1)
    @Max(10000000)
    amount?: number;

    @IsOptional()
    @IsNumber()
    @Min(0)
    totalPaid?: number;

    @IsOptional()
    @IsString()
    @IsIn(['cash', 'upi', 'cheque', 'bank_transfer', 'online'])
    paymentMode?: 'cash' | 'upi' | 'cheque' | 'bank_transfer' | 'online';

    @IsOptional()
    @IsDateString()
    date?: string;

    @IsOptional()
    @IsString()
    @MaxLength(2000)
    notes?: string;

    // Real bank/UPI/cheque reference. When omitted during the pay transition
    // the service auto-generates a TXN-YYYY-NNNNNN identifier.
    @IsOptional()
    @IsString()
    @MaxLength(200)
    transactionId?: string;

    @IsOptional()
    @IsBoolean()
    isActive?: boolean;
}
