"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.editOpSchema = void 0;
const zod_1 = require("zod");
exports.editOpSchema = zod_1.z.discriminatedUnion('op', [
    zod_1.z.object({
        op: zod_1.z.literal('replace'),
        step_id: zod_1.z.string().optional(),
        index: zod_1.z.number().int().nonnegative().optional(),
        step: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
    }),
    zod_1.z.object({
        op: zod_1.z.literal('insert_after'),
        step_id: zod_1.z.string().optional(),
        index: zod_1.z
            .number()
            .int()
            .optional()
            .describe('Root-array index of the anchor step. Use -1 (or omit both anchors) to prepend.'),
        step: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
    }),
    zod_1.z.object({
        op: zod_1.z.literal('insert_before'),
        step_id: zod_1.z.string().optional(),
        index: zod_1.z.number().int().nonnegative().optional(),
        step: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
    }),
    zod_1.z.object({
        op: zod_1.z.literal('delete'),
        step_id: zod_1.z.string().optional(),
        index: zod_1.z.number().int().nonnegative().optional(),
    }),
    zod_1.z.object({
        op: zod_1.z.literal('move'),
        from_step_id: zod_1.z.string().optional(),
        from: zod_1.z.number().int().nonnegative().optional(),
        to_step_id: zod_1.z.string().optional(),
        to: zod_1.z.number().int().nonnegative().optional(),
    }),
]);
