"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 identifyUser_1 = __importDefault(require("./identifyUser"));
const groupWorkspace_1 = __importDefault(require("./groupWorkspace"));
const assertRecord_1 = __importDefault(require("./assertRecord"));
const destination = {
    name: 'Attio (Actions)',
    description: 'The Attio destination allows you to assert Records in your Attio workspace based on Segment events',
    slug: 'actions-attio',
    mode: 'cloud',
    authentication: {
        scheme: 'oauth-managed',
        fields: {},
        testAuthentication: (request) => request('https://api.attio.com/v1/token')
    },
    extendRequest({ auth }) {
        return {
            headers: {
                authorization: `Bearer ${auth?.accessToken}`
            }
        };
    },
    actions: {
        identifyUser: identifyUser_1.default,
        groupWorkspace: groupWorkspace_1.default,
        assertRecord: assertRecord_1.default
    },
    presets: [
        {
            name: 'Identify User',
            subscribe: 'type = "identify"',
            partnerAction: 'identifyUser',
            mapping: (0, actions_core_1.defaultValues)(identifyUser_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Group Workspace',
            subscribe: 'type = "group"',
            partnerAction: 'groupWorkspace',
            mapping: (0, actions_core_1.defaultValues)(groupWorkspace_1.default.fields),
            type: 'automatic'
        }
    ]
};
exports.default = destination;
//# sourceMappingURL=index.js.map