"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lockFormAnswerGroup = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const validatePayloadAndCreateSdk_1 = require("../../lib/sdk/validatePayloadAndCreateSdk");
exports.lockFormAnswerGroup = {
    key: 'lockFormAnswerGroup',
    category: extensions_core_1.Category.EHR_INTEGRATIONS,
    title: 'Lock form answers',
    description: 'Lock form answers from form answer group to prevent further editing',
    fields: config_1.fields,
    previewable: true,
    dataPoints: config_1.dataPoints,
    onActivityCreated: async (payload, onComplete, onError) => {
        const { fields, healthieSdk } = await (0, validatePayloadAndCreateSdk_1.validatePayloadAndCreateSdk)({
            fieldsSchema: config_1.FieldsValidationSchema,
            payload,
        });
        await healthieSdk.client.mutation({
            lockFormAnswerGroup: {
                __args: {
                    input: {
                        id: fields.id,
                    },
                },
                form_answer_group: {
                    id: true,
                },
            },
        });
        await onComplete();
    },
};
//# sourceMappingURL=lockFormAnswerGroup.js.map