"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const syncAudience_1 = __importDefault(require("./syncAudience"));
const utils_1 = require("./utils");
const destination = {
    name: 'Optimizely Advanced Audience Targeting',
    slug: 'actions-optimizely-advanced-audience-targeting',
    mode: 'cloud',
    description: 'Sync Segment Engage Audiences to Optimizely Data Platform',
    authentication: {
        scheme: 'custom',
        fields: {
            apiKey: {
                label: 'Api Key',
                description: 'Api Key used for Optimizely API authorization when sending events',
                type: 'password',
                required: true
            },
            region: {
                label: 'Region',
                description: 'The Optimizely Region to sync Audience data to. Default is US',
                type: 'string',
                required: true,
                choices: [
                    { label: 'US', value: 'US' },
                    { label: 'Europe', value: 'EU' },
                    { label: 'Australia', value: 'AU' }
                ]
            }
        },
        testAuthentication: (request, { settings }) => {
            const host = (0, utils_1.getHost)(settings);
            return request(`${host}/auth`, {
                method: 'POST'
            });
        }
    },
    extendRequest({ settings }) {
        return {
            headers: { Authorization: `Bearer ${settings.apiKey}` }
        };
    },
    actions: {
        syncAudience: syncAudience_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map