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

/**
 * DTO for creating a job from the coordinator
 */
export class CreateCoordinatorJobDto {
  @IsUUID("4", { message: "workspaceId must be a valid UUID v4" })
  workspaceId!: 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; // 'code-task', 'git-status', 'priority-calc'

  @IsInt({ message: "issueNumber must be an integer" })
  @Min(1, { message: "issueNumber must be at least 1" })
  issueNumber!: number;

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

  @IsOptional()
  @IsNumber({}, { message: "priority must be a number" })
  @Min(1, { message: "priority must be at least 1" })
  @Max(100, { message: "priority must not exceed 100" })
  priority?: number;

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