import { IsObject, IsOptional, IsString, IsUUID, MaxLength, MinLength } from "class-validator";

/**
 * DTO for creating a finding
 */
export class CreateFindingDto {
  @IsOptional()
  @IsUUID("4", { message: "taskId must be a valid UUID" })
  taskId?: string;

  @IsString({ message: "agentId must be a string" })
  @MinLength(1, { message: "agentId must not be empty" })
  @MaxLength(255, { message: "agentId must not exceed 255 characters" })
  agentId!: string;

  @IsString({ message: "type must be a string" })
  @MinLength(1, { message: "type must not be empty" })
  @MaxLength(100, { message: "type must not exceed 100 characters" })
  type!: string;

  @IsString({ message: "title must be a string" })
  @MinLength(1, { message: "title must not be empty" })
  @MaxLength(255, { message: "title must not exceed 255 characters" })
  title!: string;

  @IsObject({ message: "data must be an object" })
  data!: Record<string, unknown>;

  @IsString({ message: "summary must be a string" })
  @MinLength(1, { message: "summary must not be empty" })
  @MaxLength(20000, { message: "summary must not exceed 20000 characters" })
  summary!: string;
}
