import { Type } from "class-transformer";
import {
  IsInt,
  IsNumber,
  IsOptional,
  IsString,
  IsUUID,
  Max,
  MaxLength,
  Min,
} from "class-validator";

/**
 * DTO for finding semantic similarity search
 */
export class SearchFindingsDto {
  @IsString({ message: "query must be a string" })
  @MaxLength(1000, { message: "query must not exceed 1000 characters" })
  query!: string;

  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "page must be an integer" })
  @Min(1, { message: "page must be at least 1" })
  page?: number;

  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "limit must be an integer" })
  @Min(1, { message: "limit must be at least 1" })
  @Max(100, { message: "limit must not exceed 100" })
  limit?: number;

  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: "similarityThreshold must be a number" })
  @Min(0, { message: "similarityThreshold must be at least 0" })
  @Max(1, { message: "similarityThreshold must not exceed 1" })
  similarityThreshold?: number;

  @IsOptional()
  @IsString({ message: "agentId must be a string" })
  agentId?: string;

  @IsOptional()
  @IsString({ message: "type must be a string" })
  type?: string;

  @IsOptional()
  @IsUUID("4", { message: "taskId must be a valid UUID" })
  taskId?: string;
}
