"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.eventWebhook = void 0;
const config_1 = require("../config");
const types_1 = require("../types");
const dataPoints = {
    eventType: {
        key: 'eventType',
        valueType: 'string',
    },
};
exports.eventWebhook = {
    key: 'eventWebhook',
    dataPoints,
    onWebhookReceived: async ({ payload }, onSuccess, onError) => {
        const { user: { id: value }, eventType, } = types_1.EventPayloadSchema.parse(payload);
        await onSuccess({
            data_points: {
                eventType: eventType.toString(),
            },
            patient_identifier: {
                system: config_1.WORKRAMP_IDENTIFIER,
                value,
            },
        });
    },
};
//# sourceMappingURL=EventWebhook.js.map