"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const userUpload_1 = __importDefault(require("./userUpload"));
const userDelete_1 = __importDefault(require("./userDelete"));
const actions_core_1 = require("@segment/actions-core");
const destination = {
    name: 'CleverTap (Actions)',
    slug: 'actions-clevertap',
    mode: 'cloud',
    description: 'CleverTap is a customer engagement and retention platform that provides the functionality to integrate app analytics and marketing. The platform helps customers increase user engagement in three ways:' +
        ' 1) Tracks actions users are taking and analyzes how people use the product.' +
        ' 2) [Segment](https://docs.clevertap.com/docs/segments) users based on their actions and run targeted [campaigns](https://docs.clevertap.com/docs/intro-to-campaigns) to these  segments.' +
        ' 3) [Analyze](https://docs.clevertap.com/docs/intro-to-reports) each campaign to understand its effect on user engagement and business metrics',
    authentication: {
        scheme: 'custom',
        fields: {
            clevertapAccountId: {
                label: 'CleverTap Account ID',
                description: 'CleverTap Account Id. This can be found under [Settings Page](https://developer.clevertap.com/docs/authentication#getting-your-account-credentials).',
                type: 'string',
                required: true
            },
            clevertapPasscode: {
                label: 'CleverTap Account Passcode',
                description: 'CleverTap Passcode. This can be found under [Settings Page](https://developer.clevertap.com/docs/authentication#getting-your-account-credentials).',
                type: 'password',
                required: true
            },
            clevertapEndpoint: {
                label: 'REST Endpoint',
                description: 'Learn More about [Account regions](https://docs.clevertap.com/docs/build-segment-destination#set-up-segment-destination-action).',
                type: 'string',
                format: 'uri',
                choices: [
                    { label: 'SK', value: 'https://sk1.api.clevertap.com' },
                    { label: 'EU', value: 'https://eu1.api.clevertap.com' },
                    { label: 'US', value: 'https://us1.api.clevertap.com' },
                    { label: 'SG', value: 'https://sg1.api.clevertap.com' },
                    { label: 'IN', value: 'https://in1.api.clevertap.com' }
                ],
                default: 'https://sk1.api.clevertap.com',
                required: true
            }
        }
    },
    actions: {
        userUpload: userUpload_1.default,
        userDelete: userDelete_1.default
    },
    presets: [
        {
            name: 'Event Name is Delete User',
            subscribe: 'event = "Delete User"',
            partnerAction: 'userDelete',
            mapping: (0, actions_core_1.defaultValues)(userDelete_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Event Type is Identify',
            subscribe: 'type = "identify"',
            partnerAction: 'userUpload',
            mapping: (0, actions_core_1.defaultValues)(userUpload_1.default.fields),
            type: 'automatic'
        }
    ]
};
exports.default = destination;
//# sourceMappingURL=index.js.map