"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
let { wait } = require("../../utilities");
exports.definition = {
    name: "Delay",
    icon: "Clock",
    tagline: "Delay for {{inputs.time}} milliseconds",
    description: "Delay the automation until an amount of time has passed",
    stepId: "DELAY",
    internal: true,
    inputs: {},
    schema: {
        inputs: {
            properties: {
                time: {
                    type: "number",
                    title: "Delay in milliseconds",
                },
            },
            required: ["time"],
        },
        outputs: {
            properties: {
                success: {
                    type: "boolean",
                    description: "Whether the delay was successful",
                },
            },
            required: ["success"],
        },
    },
    type: "LOGIC",
};
exports.run = function delay({ inputs }) {
    return __awaiter(this, void 0, void 0, function* () {
        yield wait(inputs.time);
        return {
            success: true,
        };
    });
};
