"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const btoa_lite_1 = __importDefault(require("btoa-lite"));
const removeContactFromList_1 = __importDefault(require("./removeContactFromList"));
const enrolContact_1 = __importDefault(require("./enrolContact"));
const addContactToList_1 = __importDefault(require("./addContactToList"));
const sendTransactionalSms_1 = __importDefault(require("./sendTransactionalSms"));
const sendSms_1 = __importDefault(require("./sendSms"));
const sendEmailCampaign_1 = __importDefault(require("./sendEmailCampaign"));
const sendTransactionalEmail_1 = __importDefault(require("./sendTransactionalEmail"));
const destination = {
    name: 'Dotdigital',
    description: 'Send Segment events and user profile data to Dotdigital.',
    slug: 'actions-dotdigital',
    mode: 'cloud',
    authentication: {
        scheme: 'basic',
        fields: {
            api_host: {
                label: 'Region',
                description: 'The region your account is in',
                type: 'string',
                choices: [
                    { value: 'https://r1-api.dotdigital.com', label: 'r1' },
                    { value: 'https://r2-api.dotdigital.com', label: 'r2' },
                    { value: 'https://r3-api.dotdigital.com', label: 'r3' }
                ],
                default: 'https://r1-api.dotdigital.com',
                required: true
            },
            username: {
                label: 'Username',
                description: 'Your Dotdigital username',
                type: 'string',
                required: true
            },
            password: {
                label: 'Password',
                description: 'Your Dotdigital password.',
                type: 'password',
                required: true
            }
        },
        testAuthentication: async (request, { settings }) => {
            return await request(`${settings.api_host}/v2/data-fields/`);
        }
    },
    extendRequest({ settings }) {
        return {
            headers: { Authorization: `Basic ${(0, btoa_lite_1.default)(settings.username + ':' + settings.password)}`, 'x-ddg-integration-token': '7d1e8cff-4856-4f45-93d3-dac7377a53c2' },
            responseType: 'json'
        };
    },
    actions: {
        removeContactFromList: removeContactFromList_1.default,
        enrolContact: enrolContact_1.default,
        addContactToList: addContactToList_1.default,
        sendTransactionalSms: sendTransactionalSms_1.default,
        sendSms: sendSms_1.default,
        sendEmailCampaign: sendEmailCampaign_1.default,
        sendTransactionalEmail: sendTransactionalEmail_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map