"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPatient = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const helpers_1 = require("../../helpers");
exports.createPatient = {
    key: 'createPatient',
    category: extensions_core_1.Category.EHR_INTEGRATIONS,
    title: 'Create patient',
    description: 'Create a patient in athena',
    fields: config_1.fields,
    previewable: true,
    dataPoints: config_1.dataPoints,
    onActivityCreated: async (payload, onComplete, onError) => {
        const { fields: input, client, settings: { practiceId }, } = await (0, helpers_1.validatePayloadAndCreateClient)({
            fieldsSchema: config_1.FieldsValidationSchema,
            payload,
        });
        const res = await client.createPatient({
            practiceId,
            data: input,
        });
        await onComplete({
            data_points: {
                createdPatientId: res.patientid,
            },
        });
    },
};
//# sourceMappingURL=createPatient.js.map