"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetAllSchedulesTool = exports.SheluderTool = void 0;
const zod_1 = require("zod");
const ai_1 = require("ai");
const sheluder_js_1 = require("../sheluder.js");
const sheluderToolInputSchema = zod_1.z.object({
    userId: zod_1.z.string().describe("wallet address of the user"),
    chain: zod_1.z.string().describe("Blockchain chain to use for the action"),
    action: zod_1.z.enum(["swap", "bridge", "zap", "buy", "sell", "addLiquidity", "removeLiquidity"]),
    data: zod_1.z.string().describe("String of JSON of Additional data for the action"),
    timeTrigger: zod_1.z.string().describe("ISO date string for when the action should be triggered"),
    onChainTrigger: zod_1.z
        .object({
        contract: zod_1.z.string().describe("Contract address for the on-chain trigger"),
        event: zod_1.z.string().describe("Event name to listen for"),
        condition: zod_1.z.string().describe("JS string condition to evaluate e.g. 'price >= 1.05'"),
    })
        .optional()
        .describe("Optional on-chain trigger configuration"),
});
const getAllSchedulesToolInputSchema = zod_1.z.object({});
class SheluderTool {
    constructor() {
        this.sheluder = new sheluder_js_1.Sheluder();
        this.tool = (0, ai_1.tool)({
            description: "Schedule an action to be executed at a later time",
            inputSchema: sheluderToolInputSchema,
            execute: async (parameters) => {
                return this.sheluder.scheduleAction(parameters);
            },
        });
    }
}
exports.SheluderTool = SheluderTool;
class GetAllSchedulesTool {
    constructor() {
        this.sheluder = new sheluder_js_1.Sheluder();
        this.tool = (0, ai_1.tool)({
            description: "Retrieve all scheduled actions",
            inputSchema: getAllSchedulesToolInputSchema,
            execute: async (_parameters) => {
                return this.sheluder.getSchedules();
            },
        });
    }
}
exports.GetAllSchedulesTool = GetAllSchedulesTool;
