"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendMessage = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
exports.sendMessage = {
    key: 'sendMessage',
    title: 'Stuur bericht (mynexuzhealth)',
    description: 'Trigger a message in the mynexuzhealth app',
    category: extensions_core_1.Category.COMMUNICATION,
    fields: config_1.fields,
    previewable: false,
    onEvent: async ({ payload, onComplete, onError, helpers }) => {
        helpers.log({ fields: payload.fields }, 'Processing sendMessage');
        try {
            await onComplete();
        }
        catch (err) {
            helpers.log({ err }, 'error', err);
            const error = err;
            await onError({
                events: [
                    {
                        date: new Date().toISOString(),
                        text: { en: error.message },
                        error: {
                            category: 'SERVER_ERROR',
                            message: error.message,
                        },
                    },
                ],
            });
        }
    },
};
//# sourceMappingURL=sendMessage.js.map