"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteGoal = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const validatePayloadAndCreateSdk_1 = require("../../lib/sdk/validatePayloadAndCreateSdk");
exports.deleteGoal = {
    key: 'deleteGoal',
    category: extensions_core_1.Category.EHR_INTEGRATIONS,
    title: 'Delete goal',
    description: 'Delete a goal for a patient in Healthie',
    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({
            deleteGoal: {
                __args: {
                    input: {
                        id: fields.goalId,
                    },
                },
                goal: {
                    id: true,
                },
            },
        });
        await onComplete();
    },
};
//# sourceMappingURL=deleteGoal.js.map