"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const actions_core_1 = require("@segment/actions-core");
const sendEvent_1 = __importDefault(require("./sendEvent"));
const upsertUserProfile_1 = __importDefault(require("./upsertUserProfile"));
const constants_1 = require("./constants");
const destination = {
    name: 'Aampe (Actions)',
    slug: 'actions-aampe',
    mode: 'cloud',
    authentication: {
        scheme: 'basic',
        fields: {
            apiKey: {
                label: 'API Key',
                description: 'Your Aampe API Key',
                type: 'password',
                required: true
            },
            region: {
                label: 'Region',
                description: 'Your data region',
                type: 'string',
                required: true,
                choices: [
                    { label: 'Singapore', value: constants_1.SingaporeURL },
                    { label: 'Germany', value: constants_1.GermanyURL },
                    { label: 'France', value: constants_1.FranceURL }
                ],
                default: constants_1.SingaporeURL
            }
        }
    },
    extendRequest({ settings }) {
        return {
            headers: {
                Authorization: `Bearer ${settings.apiKey}`
            }
        };
    },
    actions: {
        sendEvent: sendEvent_1.default,
        upsertUserProfile: upsertUserProfile_1.default
    },
    presets: [
        {
            name: 'Send Event',
            subscribe: 'type = "track" or type = "page" or type = "screen"',
            partnerAction: 'sendEvent',
            mapping: (0, actions_core_1.defaultValues)(sendEvent_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Identify User',
            subscribe: 'type = "identify"',
            partnerAction: 'upsertUserProfile',
            mapping: (0, actions_core_1.defaultValues)(upsertUserProfile_1.default.fields),
            type: 'automatic'
        }
    ]
};
exports.default = destination;
//# sourceMappingURL=index.js.map