"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const send_1 = __importDefault(require("./send"));
const destination = {
    name: 'Spiffy',
    slug: 'actions-spiffy',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            org_id: {
                label: 'Organization ID',
                description: 'Spiffy Org ID',
                type: 'string',
                required: true
            },
            api_key: {
                label: 'API Key',
                description: 'Spiffy Org API Key',
                type: 'password',
                required: true
            },
            environment: {
                label: 'Spiffy Environment',
                description: 'Spiffy Org Environment',
                type: 'string',
                required: true,
                choices: [
                    {
                        value: 'prod',
                        label: 'Production'
                    },
                    {
                        value: 'dev',
                        label: 'Development'
                    }
                ]
            }
        },
        testAuthentication: (request, { settings }) => {
            const environment = settings.environment;
            const url = environment == 'prod'
                ? 'https://segment-intake.spiffy.ai/v1/auth'
                : 'https://segment-intake.dev.spiffy.ai/v1/auth';
            return request(url);
        }
    },
    extendRequest({ settings }) {
        return {
            headers: { Authorization: `Bearer ${settings.org_id}:${settings.api_key}` },
            responseType: 'json'
        };
    },
    actions: {
        send: send_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map