"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePayloadAndCreateSdk = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const zod_1 = __importDefault(require("zod"));
const settings_1 = require("../../settings");
const client_1 = require("./v2/client");
const validatePayloadAndCreateSdk = async ({ fieldsSchema, payload, }) => {
    const { settings, fields } = (0, extensions_core_1.validate)({
        schema: zod_1.default.object({
            fields: fieldsSchema,
            settings: settings_1.SettingsValidationSchema,
        }),
        payload,
    });
    const { patient, pathway, activity } = payload;
    const calv2Client = new client_1.CalV2ApiClient({
        baseUrl: 'https://api.cal.com/v2',
        apiKey: settings.apiKey,
        calApiVersion: '2024-08-13',
    });
    return {
        calv2Client,
        settings,
        fields,
        patient,
        pathway,
        activity,
    };
};
exports.validatePayloadAndCreateSdk = validatePayloadAndCreateSdk;
//# sourceMappingURL=validatePayloadAndCreateSdk.js.map