import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import {
  IsEmail,
  IsNotEmpty,
  IsOptional,
  IsString,
  MaxLength,
} from "class-validator";

export class CreateClienteDto {
  @ApiPropertyOptional({
    description:
      "Código único del cliente (se genera automáticamente si no se proporciona)",
  })
  @IsOptional()
  @IsString()
  @MaxLength(24)
  tarjeta?: string;

  @ApiProperty({ description: "Nombre completo del cliente" })
  @IsNotEmpty({ message: "El nombre es requerido" })
  @IsString()
  @MaxLength(255)
  nombre: string;

  @ApiProperty({ description: "NIT del cliente" })
  @IsNotEmpty({ message: "El NIT es requerido" })
  @IsString()
  @MaxLength(24)
  nit: string;

  @ApiProperty({ description: "Dirección del cliente" })
  @IsNotEmpty({ message: "La dirección es requerida" })
  @IsString()
  @MaxLength(255)
  direccion: string;

  @ApiPropertyOptional({ description: "Teléfono fijo" })
  @IsOptional()
  @IsString()
  @MaxLength(48)
  telefono?: string;

  @ApiPropertyOptional({ description: "Celular" })
  @IsOptional()
  @IsString()
  @MaxLength(10)
  celular?: string;

  @ApiPropertyOptional({ description: "Correo electrónico" })
  @IsOptional()
  @IsEmail({}, { message: "Email inválido" })
  @MaxLength(255)
  email?: string;
}
