"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFormAnswers = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const validatePayloadAndCreateSdk_1 = require("../../lib/sdk/validatePayloadAndCreateSdk");
exports.getFormAnswers = {
    key: 'getFormAnswers',
    category: extensions_core_1.Category.EHR_INTEGRATIONS,
    title: 'Get form answers',
    description: 'Retrieve form answers from form answer group',
    fields: config_1.fields,
    previewable: true,
    dataPoints: config_1.dataPoints,
    onActivityCreated: async (payload, onComplete, onError) => {
        var _a;
        const { fields: input, sdk } = await (0, validatePayloadAndCreateSdk_1.validatePayloadAndCreateSdk)({
            fieldsSchema: config_1.FieldsValidationSchema,
            payload,
        });
        const res = await sdk.getFormAnswerGroup(input);
        await onComplete({
            data_points: {
                formAnswers: JSON.stringify((_a = res.data.formAnswerGroup) === null || _a === void 0 ? void 0 : _a.form_answers),
            },
        });
    },
};
//# sourceMappingURL=getFormAnswers.js.map