"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ingest_1 = __importDefault(require("./ingest"));
const remove_1 = __importDefault(require("./remove"));
const destination = {
    name: 'Google Data Manager',
    slug: 'actions-google-data-manager',
    mode: 'cloud',
    authentication: {
        scheme: 'oauth2',
        fields: {},
        testAuthentication: (_request) => {
        },
        refreshAccessToken: async (request, { auth }) => {
            const res = await request('https://www.example.com/oauth/refresh', {
                method: 'POST',
                body: new URLSearchParams({
                    refresh_token: auth.refreshToken,
                    client_id: auth.clientId,
                    client_secret: auth.clientSecret,
                    grant_type: 'refresh_token'
                })
            });
            return { accessToken: res.data.access_token };
        }
    },
    extendRequest({ auth }) {
        return {
            headers: {
                authorization: `Bearer ${auth?.accessToken}`
            }
        };
    },
    audienceFields: {},
    audienceConfig: {
        mode: {
            type: 'synced',
            full_audience_sync: false
        },
        createAudience: async (_request, _createAudienceInput) => {
            return { externalId: '' };
        },
        getAudience: async (_request, _getAudienceInput) => {
            return { externalId: '' };
        }
    },
    onDelete: async (_request) => {
    },
    actions: {
        ingest: ingest_1.default,
        remove: remove_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map