import { IsString, IsOptional, IsObject, MinLength, MaxLength } from "class-validator";
import type { QualityGateResult } from "../interfaces";

/**
 * DTO for failing a job from the coordinator
 */
export class FailJobDto {
  @IsString({ message: "error must be a string" })
  @MinLength(1, { message: "error must not be empty" })
  @MaxLength(10000, { message: "error must not exceed 10000 characters" })
  error!: string;

  @IsOptional()
  @IsObject({ message: "gateResults must be an object" })
  gateResults?: QualityGateResult;

  @IsOptional()
  @IsString({ message: "failedStep must be a string" })
  @MaxLength(255, { message: "failedStep must not exceed 255 characters" })
  failedStep?: string;

  @IsOptional()
  @IsString({ message: "continuationPrompt must be a string" })
  @MaxLength(5000, { message: "continuationPrompt must not exceed 5000 characters" })
  continuationPrompt?: string;
}
