"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendQuestionnaire = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
exports.sendQuestionnaire = {
    key: 'sendQuestionnaire',
    title: 'Stuur vragenlijst (mynexuzhealth)',
    description: 'Trigger a questionaire 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 sendQuestionnaire');
        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=sendQuestionnaire.js.map