import { JobStepPhase, JobStepType, JobStepStatus } from "@prisma/client";
import { IsString, IsEnum, IsInt, IsOptional, MinLength, MaxLength, Min } from "class-validator";

/**
 * DTO for creating a new job step
 */
export class CreateStepDto {
  @IsInt({ message: "ordinal must be an integer" })
  @Min(0, { message: "ordinal must be at least 0" })
  ordinal!: number;

  @IsEnum(JobStepPhase, { message: "phase must be a valid JobStepPhase" })
  phase!: JobStepPhase;

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

  @IsEnum(JobStepType, { message: "type must be a valid JobStepType" })
  type!: JobStepType;

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