"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const common_definitions_1 = require("../common-definitions");
const request_params_1 = require("../request-params");
const action = {
    title: 'Group',
    description: 'Send company attributes to Usermaven.',
    fields: {
        company_id: {
            type: 'string',
            required: true,
            description: 'The company id, to uniquely identify the company',
            label: 'Company id',
            default: { '@path': '$.groupId' }
        },
        user_id: {
            type: 'string',
            required: true,
            description: 'The user id, to uniquely identify the user',
            label: 'User id',
            default: { '@path': '$.userId' }
        },
        company_name: {
            type: 'string',
            required: false,
            description: 'The company name',
            label: 'Company name',
            default: { '@path': '$.traits.name' }
        },
        company_created_at: {
            type: 'string',
            required: false,
            description: 'The timestamp when the company was created',
            label: 'Company created at',
            default: { '@path': '$.traits.created_at' }
        },
        company_custom_attributes: {
            type: 'object',
            required: false,
            description: 'The company custom attributes',
            label: 'Company custom attributes',
            default: { '@path': '$.traits' }
        },
        ...common_definitions_1.commonFields
    },
    perform: (request, { payload, settings }) => {
        const resolvedPayload = (0, request_params_1.resolveRequestPayload)(settings, payload);
        const { url, options } = (0, request_params_1.eventRequestParams)(settings, resolvedPayload, 'group');
        return request(url, options);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map