import { ApiProperty } from '@nestjs/swagger';
import { IsIn, IsNotEmpty, IsNumber, IsOptional, IsString, Min } from 'class-validator';

export class MovimientoCajaDto {
  @ApiProperty({ example: 'ENTRADA', description: 'Tipo de movimiento', enum: ['ENTRADA', 'SALIDA'] })
  @IsNotEmpty()
  @IsString()
  @IsIn(['ENTRADA', 'SALIDA'])
  tipo: 'ENTRADA' | 'SALIDA';

  @ApiProperty({ example: 50000, description: 'Monto del movimiento' })
  @IsNotEmpty()
  @IsNumber()
  @Min(0.01)
  monto: number;

  @ApiProperty({ example: 'Pago a proveedor', description: 'Concepto del movimiento' })
  @IsNotEmpty()
  @IsString()
  concepto: string;

  @ApiProperty({ example: 'FAC-001', description: 'Referencia opcional', required: false })
  @IsOptional()
  @IsString()
  referencia?: string;
}
