import { AgentTaskStatus, AgentTaskPriority } from "@prisma/client";
import { IsString, IsOptional, IsEnum, IsObject, MinLength, MaxLength } from "class-validator";

/**
 * DTO for updating an existing agent task
 * All fields are optional to support partial updates
 */
export class UpdateAgentTaskDto {
  @IsOptional()
  @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;

  @IsOptional()
  @IsString({ message: "description must be a string" })
  @MaxLength(10000, { message: "description must not exceed 10000 characters" })
  description?: string | null;

  @IsOptional()
  @IsEnum(AgentTaskStatus, { message: "status must be a valid AgentTaskStatus" })
  status?: AgentTaskStatus;

  @IsOptional()
  @IsEnum(AgentTaskPriority, { message: "priority must be a valid AgentTaskPriority" })
  priority?: AgentTaskPriority;

  @IsOptional()
  @IsString({ message: "agentType must be a string" })
  @MinLength(1, { message: "agentType must not be empty" })
  agentType?: string;

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

  @IsOptional()
  @IsObject({ message: "result must be an object" })
  result?: Record<string, unknown> | null;

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