import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, MaxLength, MinLength } from 'class-validator';

export class CreateCondicionPagoDto {
  @ApiProperty({ description: 'Descripción', example: 'Contado' })
  @IsString()
  @IsNotEmpty()
  @MinLength(2)
  @MaxLength(15)
  descripcion: string;

  @ApiProperty({ description: 'Días de plazo', example: 0, required: false })
  @IsOptional()
  @IsNumber()
  dias_plazo?: number;

  @ApiProperty({ description: 'Cantidad de cuotas', example: 1, required: false })
  @IsOptional()
  @IsNumber()
  cuotas?: number;

  @ApiProperty({ description: 'Intervalo en días entre cuotas', example: 30, required: false })
  @IsOptional()
  @IsNumber()
  intervalo_dias?: number;

  @ApiProperty({ description: 'Aplica a: VENTAS, COMPRAS, AMBOS', example: 'VENTAS', required: false })
  @IsOptional()
  @IsString()
  @MaxLength(12)
  aplica_a?: string;

  @ApiProperty({ description: 'Requiere cuota inicial', example: false, required: false })
  @IsOptional()
  @IsBoolean()
  cuota_inicial?: boolean;

  @ApiProperty({ description: 'Código condición venta SIFEN', example: 1, required: false })
  @IsOptional()
  @IsNumber()
  cod_condicion_venta?: number;

  @ApiProperty({ description: 'Código tipo crédito SIFEN', example: 1, required: false })
  @IsOptional()
  @IsNumber()
  cod_tipo_credito?: number;

  @ApiProperty({ description: 'Es condición por defecto', example: false, required: false })
  @IsOptional()
  @IsBoolean()
  es_default?: boolean;

  @ApiProperty({ description: 'Estado activo', example: true, required: false })
  @IsOptional()
  @IsBoolean()
  activo?: boolean;
}
