"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fields_1 = require("../fields");
const constants_1 = require("../constants");
const functions_1 = require("../functions");
const action = {
    title: 'Subscribe User to Attentive',
    description: 'Send a subscription request to Attentive.',
    defaultSubscription: 'type = "track" and event = "User Subscibed"',
    fields: {
        userIdentifiers: fields_1.userIdentifiers,
        occurredAt: fields_1.occurredAt,
        externalEventId: fields_1.externalEventId,
        subscriptionType: fields_1.subscriptionType,
        locale: fields_1.locale,
        signUpSourceId: fields_1.signUpSourceId,
        singleOptIn: fields_1.singleOptIn
    },
    perform: (request, { payload }) => {
        (0, functions_1.validate)(payload);
        (0, functions_1.validateSubscribeUser)(payload);
        return request(`${constants_1.API_URL}/${constants_1.API_VERSION}/subscriptions`, {
            method: 'post',
            json: (0, functions_1.formatSubscribeUserJSON)(payload)
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map