import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, IsUUID, Length } from 'class-validator';

export class CreatePuntoExpedicionDto {
  @ApiProperty({ example: 'cd88ac6a-2b0e-41bc-afd9-24b594cb8daf' })
  @IsNotEmpty({ message: 'Empresa es obligatoria' })
  @IsUUID('all', { message: 'Empresa debe ser un UUID válido' })
  empresa_id: string;

  @ApiProperty({ example: 'cd88ac6a-2b0e-41bc-afd9-24b594cb8daf' })
  @IsNotEmpty({ message: 'Sucursal es obligatoria' })
  @IsUUID('all', { message: 'Sucursal debe ser un UUID válido' })
  sucursal_id: string;

  @ApiProperty({ example: 'cd88ac6a-2b0e-41bc-afd9-24b594cb8daf', required: false })
  @IsOptional()
  @IsUUID('all', { message: 'Caja debe ser un UUID válido' })
  caja_id?: string;

  @ApiProperty({ example: '001' })
  @IsString({ message: 'Punto expedicion debe ser un string' })
  @IsNotEmpty({ message: 'Punto expedicion es obligatorio' })
  @Length(3, 3, { message: 'Punto expedicion debe tener exactamente 3 dígitos' })
  punto_expedicion: string;

  @ApiProperty({ example: '0000001', required: false })
  @IsOptional()
  @IsString({ message: 'Número inicial debe ser un string' })
  @Length(7, 7, { message: 'Número inicial debe tener exactamente 7 dígitos' })
  num_inicial?: string;

  @ApiProperty({ example: 'Punto de venta principal', required: false })
  @IsOptional()
  @IsString({ message: 'Descripción debe ser un string' })
  descripcion?: string;

  @ApiProperty({ example: 'Tu mejor opción', required: false })
  @IsOptional()
  @IsString({ message: 'Eslogan debe ser un string' })
  eslogan?: string;

  @IsOptional()
  @IsString()
  usuario?: string;
}
