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

export class CreateMecanicoDto {
  @ApiProperty({ description: "Nombre del mecanico" })
  @IsString()
  @IsNotEmpty()
  @MaxLength(255)
  nombre: string;

  @ApiPropertyOptional({ description: "Telefono" })
  @IsOptional()
  @IsString()
  @MaxLength(100)
  telefono?: string;

  @ApiPropertyOptional({ description: "Correo" })
  @IsOptional()
  @IsEmail()
  @MaxLength(255)
  email?: string;

  @ApiPropertyOptional({ description: "Especialidad" })
  @IsOptional()
  @IsString()
  @MaxLength(255)
  especialidad?: string;

  @ApiPropertyOptional({ description: "Tienda asignada" })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  tiendaId?: number;
}
