import { AgentTaskStatus, AgentTaskPriority } from "@prisma/client";
import { IsOptional, IsEnum, IsInt, Min, Max, IsString, IsUUID } from "class-validator";
import { Type } from "class-transformer";

/**
 * DTO for querying agent tasks with pagination and filters
 */
export class QueryAgentTasksDto {
  @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()
  @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" })
  agentType?: string;

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

  // Internal field set by controller/guard
  workspaceId?: string;
}
