// server/src/user-setting/dto/create-user-setting.dto.ts
import {
  IsBoolean,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Max,
  Min,
} from 'class-validator';
import { DEFAULT_SETTINGS } from '../../defaults'; // Import default settings for validation min/max

export class CreateUserSettingDto {
  @IsString()
  selectedLLMId: string = DEFAULT_SETTINGS.selectedLLMId;

  @IsString()
  selectedEmbeddingId: string = DEFAULT_SETTINGS.selectedEmbeddingId;

  @IsString()
  @IsOptional()
  selectedRerankId?: string = DEFAULT_SETTINGS.selectedRerankId;

  @IsNumber()
  @Min(0)
  @Max(1)
  temperature: number = DEFAULT_SETTINGS.temperature;

  @IsNumber()
  @Min(1) // Assuming min 1 token
  maxTokens: number = DEFAULT_SETTINGS.maxTokens;

  @IsBoolean()
  enableRerank: boolean = DEFAULT_SETTINGS.enableRerank;

  @IsNumber()
  @Min(1)
  topK: number = DEFAULT_SETTINGS.topK;

  @IsNumber()
  @Min(0) // Score threshold usually 0 to 1
  @Max(1)

  @IsNumber()
  @Min(0)
  @Max(1)
  @IsOptional()
  similarityThreshold: number = DEFAULT_SETTINGS.similarityThreshold;

  @IsNumber()
  @Min(0)
  @Max(1)
  @IsOptional()
  rerankSimilarityThreshold: number = DEFAULT_SETTINGS.rerankSimilarityThreshold;

  @IsBoolean()
  @IsOptional()
  enableFullTextSearch: boolean = DEFAULT_SETTINGS.enableFullTextSearch;

  @IsNumber()
  @Min(0)
  @Max(1)
  @IsOptional()
  hybridVectorWeight: number = DEFAULT_SETTINGS.hybridVectorWeight;

  @IsBoolean()
  @IsOptional()
  enableQueryExpansion: boolean = DEFAULT_SETTINGS.enableQueryExpansion;

  @IsBoolean()
  @IsOptional()
  enableHyDE: boolean = DEFAULT_SETTINGS.enableHyDE;

  @IsNumber()
  @IsOptional()
  chunkSize: number = DEFAULT_SETTINGS.chunkSize;

  @IsNumber()
  @IsOptional()
  chunkOverlap: number = DEFAULT_SETTINGS.chunkOverlap;

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