"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSdkClient = void 0;
const lib_1 = require("twilio/lib");
const extensions_core_1 = require("@awell-health/extensions-core");
const zod_1 = __importDefault(require("zod"));
const settings_1 = require("../settings");
const twilio_1 = __importDefault(require("./sdk/twilio"));
const createSdkClient = async ({ payload }) => {
    const { settings: { accountSid, authToken, clientId }, } = (0, extensions_core_1.validate)({
        schema: zod_1.default.object({
            settings: settings_1.SettingsValidationSchema,
        }),
        payload,
    });
    if (clientId !== undefined) {
        const client = new lib_1.Twilio(clientId, authToken, {
            accountSid,
            region: 'IE1',
        });
        return { client };
    }
    else {
        const client = (0, twilio_1.default)(accountSid, authToken, {
            region: 'IE1',
            accountSid,
        });
        return { client };
    }
};
exports.createSdkClient = createSdkClient;
//# sourceMappingURL=createSdkClient.js.map