"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wait = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const extensions_core_2 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const zod_1 = require("zod");
exports.wait = {
    key: 'wait',
    category: extensions_core_2.Category.WORKFLOW,
    title: 'Wait',
    description: 'Wait n number of seconds before completing',
    fields: config_1.fields,
    dataPoints: config_1.dataPoints,
    previewable: true,
    onActivityCreated: async (payload, onComplete, onError) => {
        const { fields: { seconds }, } = (0, extensions_core_1.validate)({
            schema: zod_1.z.object({
                fields: config_1.FieldsValidationSchema,
            }),
            payload,
        });
        const waitInMs = seconds * 1000;
        await new Promise((resolve) => setTimeout(resolve, waitInMs));
        await onComplete();
    },
};
//# sourceMappingURL=wait.js.map