"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = __importDefault(require("./config"));
const track_1 = __importDefault(require("./track"));
const destination = {
    name: 'AppFit',
    slug: 'actions-app-fit',
    mode: 'cloud',
    authentication: {
        scheme: 'custom',
        fields: {
            apiKey: {
                label: 'API Key',
                description: 'AppFit project API key. ',
                type: 'password',
                required: true
            }
        },
        testAuthentication: (request, { settings }) => {
            return request(`${config_1.default.apiUrl}/api-keys/current`, {
                headers: { Authorization: `Basic ${settings.apiKey}` }
            });
        }
    },
    onDelete: async (request, { settings, payload }) => {
        return request(`${config_1.default.apiUrl}/metric-event-users/${payload.userId}?source=segment_destination`, {
            headers: { Authorization: `Bearer ${settings.apiKey}` },
            method: 'DELETE'
        });
    },
    actions: {
        track: track_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map