"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateFlowStepSchema = exports.stepGroupStepSchema = void 0;
const zod_1 = require("zod");
const common_1 = require("../common");
const stepGroupIntentSchema = zod_1.z
    .object({
    description: zod_1.z.string(),
})
    .passthrough();
const iterationConfigurationSchema = zod_1.z
    .object({
    iteration_type: zod_1.z
        .enum(['fixed', 'variable', 'list', 'none'])
        .optional()
        .describe('How to iterate the flow: fixed = repeat N times, variable = repeat count from a variable, list = iterate over a data table, none = no iteration'),
    iteration_value: zod_1.z
        .string()
        .optional()
        .describe('Iteration count (for fixed) or variable name (for variable/list)'),
})
    .passthrough();
const flowConfigurationSchema = zod_1.z
    .object({
    iterations: iterationConfigurationSchema.optional(),
    parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
})
    .passthrough();
const flowDescriptorSchema = zod_1.z
    .object({
    invariant_id: zod_1.z.string(),
})
    .passthrough();
exports.stepGroupStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    steps: zod_1.z
        .array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
        .describe('Nested steps in singleton-map format (can include other StepGroups)'),
    intent: stepGroupIntentSchema.describe('Purpose description explaining what this group of steps does'),
    isMobile: zod_1.z
        .boolean()
        .optional()
        .describe('Transient runtime flag indicating this group runs in a mobile context'),
})
    .passthrough()
    .describe('Group of steps executed together with a shared intent description');
exports.evaluateFlowStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    flow: flowDescriptorSchema.describe('Reference to the flow to execute'),
    config: flowConfigurationSchema
        .optional()
        .describe('Parameter overrides and iteration configuration for the flow'),
})
    .passthrough()
    .describe('Execute a reusable flow by reference');
