"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("../constants/api");
const action = {
    title: 'Group',
    description: 'Updates or adds properties to a company. Company is created if it does not exist.',
    defaultSubscription: 'type = "group"',
    fields: {
        groupId: {
            label: 'Group ID',
            type: 'string',
            required: true,
            description: 'The unique identifier of the group.',
            default: {
                '@path': '$.groupId'
            }
        },
        traits: {
            label: 'Group Properties',
            type: 'object',
            description: 'Properties to set on the group profile',
            default: {
                '@path': '$.traits'
            }
        },
        type: {
            label: 'Type',
            type: 'string',
            required: true,
            description: 'The type of the event',
            default: {
                '@path': '$.type'
            }
        },
        userId: {
            label: 'User ID',
            type: 'string',
            description: 'The unique identifier of the user.',
            default: {
                '@path': '$.userId'
            }
        }
    },
    perform: (request, { payload }) => {
        const { groupId, type, traits, userId } = payload;
        const body = JSON.stringify({ groupId, traits, type, userId });
        return request(`${api_1.BASE_API_URL}/group`, {
            method: 'post',
            body
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map