"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const createContactactivity_1 = __importDefault(require("./createContactactivity"));
const upsertContact_1 = __importDefault(require("./upsertContact"));
const addContactToList_1 = __importDefault(require("./addContactToList"));
const removeContactFromList_1 = __importDefault(require("./removeContactFromList"));
const addProductToCart_1 = __importDefault(require("./addProductToCart"));
const removeProductFromCart_1 = __importDefault(require("./removeProductFromCart"));
const upsertOrder_1 = __importDefault(require("./upsertOrder"));
const mergeContacts_1 = __importDefault(require("./mergeContacts"));
const destination = {
    name: 'Cordial (Actions)',
    description: 'Sync Segment Users, Groups and Events to Cordial',
    slug: 'actions-cordial',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            apiKey: {
                label: 'API Key',
                description: 'Your Cordial API Key',
                type: 'password',
                required: true
            },
            endpoint: {
                label: 'Endpoint',
                description: "Cordial API endpoint. Leave default, unless you've been provided with another one. [See more details](https://support.cordial.com/hc/en-us/sections/200553578-REST-API-Introduction-and-Overview)",
                type: 'string',
                required: true,
                format: 'uri',
                default: 'https://integrations-ingest-svc.usw1.cordial.com'
            },
            segmentIdKey: {
                label: 'User ID attribute key',
                description: 'Cordial string unique attribute key to store Segment User ID in (e.g. `segment_id`)',
                type: 'string',
                required: false
            }
        },
        testAuthentication: (request, { settings }) => {
            return request(settings.endpoint + '/api/checkAuth', { headers: { 'Content-Type': 'application/json' } });
        }
    },
    extendRequest({ settings }) {
        return {
            headers: { 'x-api-key': `${settings.apiKey}`, Accept: 'application/json' }
        };
    },
    actions: {
        createContactactivity: createContactactivity_1.default,
        upsertContact: upsertContact_1.default,
        addContactToList: addContactToList_1.default,
        removeContactFromList: removeContactFromList_1.default,
        addProductToCart: addProductToCart_1.default,
        removeProductFromCart: removeProductFromCart_1.default,
        upsertOrder: upsertOrder_1.default,
        mergeContacts: mergeContacts_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map