// server/src/model-config/dto/create-model-config.dto.ts
import {
  IsBoolean,
  IsEnum,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  IsUrl,
  Max,
  Min,
  MinLength,
} from 'class-validator';
import { ModelType } from '../../types';

export class CreateModelConfigDto {
  @IsString()
  @IsNotEmpty()
  name: string;

  @IsString()
  @IsNotEmpty()
  modelId: string;

  @IsUrl({ require_tld: false }, { message: 'Base URL must be a valid URL' })
  @IsOptional()
  baseUrl?: string;

  @IsString()
  @IsOptional()
  apiKey?: string; // API key is optional - allow local models

  @IsEnum(ModelType)
  @IsNotEmpty()
  type: ModelType;

  @IsNumber()
  @Min(1, { message: 'The minimum value of the vector dimension is 1' })
  @Max(4096, { message: 'The maximum vector dimension is 4096 (Elasticsearch limit)' })
  @IsOptional()
  dimensions?: number;

  

  
  @IsNumber()
  @Min(1)
  @Max(100000)
  @IsOptional()
  maxInputTokens?: number;

  
  @IsNumber()
  @Min(1)
  @Max(10000)
  @IsOptional()
  maxBatchSize?: number;

  
  @IsBoolean()
  @IsOptional()
  isVectorModel?: boolean;

  
  @IsString()
  @IsOptional()
  providerName?: string;

  
  @IsBoolean()
  @IsOptional()
  isEnabled?: boolean;

  
  @IsBoolean()
  @IsOptional()
  isDefault?: boolean;
}
