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

export enum VoucherTypeFilter {
  QUOTATION = 'QUOTATION',
  ORDER_CONFIRMATION = 'ORDER_CONFIRMATION',
  INVOICE = 'INVOICE',
  CREDIT_NOTE = 'CREDIT_NOTE',
}

export class QueryLexwareVouchersDto {
  @ApiPropertyOptional({ enum: VoucherTypeFilter })
  @IsOptional()
  @IsEnum(VoucherTypeFilter)
  voucherType?: VoucherTypeFilter;

  @ApiPropertyOptional({
    description: 'Beleg-Status (draft, open, paidoff, voided)',
  })
  @IsOptional()
  @IsString()
  voucherStatus?: string;

  @ApiPropertyOptional({ default: 1 })
  @IsOptional()
  @IsNumber()
  @Min(1)
  page?: number;

  @ApiPropertyOptional({ default: 25, maximum: 100 })
  @IsOptional()
  @IsNumber()
  @Min(1)
  @Max(100)
  pageSize?: number;
}
