"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const action = {
    title: 'Track Event',
    description: 'Send an event to Prodeology.',
    defaultSubscription: 'type = "track"',
    fields: {
        event: {
            type: 'string',
            required: true,
            description: 'The event name',
            label: 'Event Name',
            default: { '@path': '$.event' }
        },
        properties: {
            type: 'object',
            required: false,
            description: 'Properties to send with the event',
            label: 'Event properties',
            default: { '@path': '$.properties' }
        },
        timestamp: {
            type: 'string',
            format: 'date-time',
            required: true,
            description: 'The timestamp of the event',
            label: 'Timestamp',
            default: { '@path': '$.timestamp' }
        },
        anonymousId: {
            type: 'string',
            required: false,
            description: 'The anonymous ID associated with the user',
            label: 'Anonymous ID',
            default: { '@path': '$.anonymousId' }
        },
        userId: {
            type: 'string',
            required: false,
            description: 'The ID associated with the user',
            label: 'User ID',
            default: { '@path': '$.userId' }
        },
        context: {
            type: 'object',
            required: false,
            description: 'Context properties to send with the event',
            label: 'Context properties',
            default: { '@path': '$.context' }
        },
        messageId: {
            type: 'string',
            required: true,
            description: 'The Segment messageId',
            label: 'MessageId',
            default: { '@path': '$.messageId' }
        }
    },
    perform: (request, { payload }) => {
        return request('https://api-dev.prodeology.com/api/v1/event-collection/track', {
            method: 'POST',
            json: {
                event: payload.event,
                properties: payload.properties,
                timestamp: payload.timestamp,
                userId: payload.userId,
                anonymousId: payload.anonymousId,
                context: payload.context,
                messageId: payload.messageId
            }
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map