import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, ValidateIf } from 'class-validator';
import { InvoiceType } from 'src/modules/configuration/export/constants';

export class DownloadPdfDto {
  @ApiProperty({
    type: 'string',
    required: false,
    description: `Select ${Object.values(InvoiceType)}`,
  })
  @ValidateIf((body) => body.invoice_type)
  @IsEnum(InvoiceType, {
    message: `invoice type must be a valid enum ${JSON.stringify(
      Object.values(InvoiceType),
    )}`,
  })
  invoice_type: InvoiceType;
}
