"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const pick_1 = __importDefault(require("lodash/pick"));
const utils_1 = require("../utils");
const common_definitions_1 = require("../common-definitions");
const action = {
    title: 'Alias User',
    description: 'Change the User ID of an user.',
    defaultSubscription: 'type = "alias"',
    fields: {
        userId: {
            type: 'string',
            required: true,
            description: 'The new User ID to associate with the user in Encharge.',
            label: 'User ID',
            default: { '@path': '$.userId' }
        },
        previousUserId: {
            type: 'string',
            required: true,
            description: 'The previous User ID associated with the user in Encharge.',
            label: 'Previous User ID',
            default: { '@path': '$.previousId' }
        },
        ...(0, pick_1.default)(common_definitions_1.commonFields, ['timestamp', 'messageId'])
    },
    perform: (request, data) => {
        const payload = {
            ...data.payload,
            type: 'alias'
        };
        return request(utils_1.enchargeIngestAPIURL, {
            method: 'post',
            json: payload
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map