"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bookingCreated = void 0;
const lodash_1 = require("lodash");
const dataPoints = {
    bookingId: {
        key: 'bookingId',
        valueType: 'string',
    },
    bookingUid: {
        key: 'bookingUid',
        valueType: 'string',
    },
};
exports.bookingCreated = {
    key: 'bookingCreated',
    dataPoints,
    onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
        const { payload: { bookingId, uid }, } = payload;
        if ((0, lodash_1.isNil)(bookingId) || (0, lodash_1.isNil)(uid)) {
            await onError({
            // We should automatically send a 400 here, so no need to provide info
            });
        }
        else {
            await onSuccess({
                data_points: {
                    bookingId: String(bookingId),
                    bookingUid: uid,
                },
            });
        }
    },
};
//# sourceMappingURL=bookingCreated.js.map