import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { IsIn, IsInt, IsNotEmpty, IsOptional, IsString, Min, } from "class-validator"; import { StepType } from "../scenario-step.entity"; export class CreateScenarioStepDto { @ApiProperty({ example: 0, description: "Execution order (ascending)" }) @IsInt() @Min(0) order: number; @ApiProperty({ enum: ["login", "exec", "sign"], example: "exec" }) @IsIn(["login", "exec", "sign"]) type: StepType; @ApiProperty({ description: "Session name used by this step. login steps create it; exec steps consume it.", example: "my-session", }) @IsString() @IsNotEmpty() sessionName: string; @ApiPropertyOptional({ example: "return await page.title();" }) @IsOptional() @IsString() @IsNotEmpty() execCode?: string; @ApiPropertyOptional({ example: 'return { success: result !== null, description: "title present" };', }) @IsOptional() @IsString() @IsNotEmpty() validateCode?: string; }