"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPatient = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const lib_1 = require("../../lib");
exports.getPatient = {
    key: 'getPatient',
    category: extensions_core_1.Category.WORKFLOW,
    title: 'Get patient',
    description: 'Retrieve patient details from Dock',
    fields: config_1.fields,
    previewable: true,
    dataPoints: config_1.dataPoints,
    onActivityCreated: async (payload, onComplete, onError) => {
        const { fields, dockClient } = await (0, lib_1.validatePayloadAndCreateClient)({
            fieldsSchema: config_1.FieldsValidationSchema,
            payload,
        });
        const res = await dockClient.getPatient({ id: fields.dockPatientId });
        await onComplete({
            data_points: {
                firstName: res.firstName,
                lastName: res.lastName,
            },
        });
    },
};
//# sourceMappingURL=getPatient.js.map