"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fields_1 = require("../fields");
const action = {
    title: 'Send Event',
    description: 'Send analytics, page and screen events to Aampe.',
    defaultSubscription: 'type = "track" or type = "page" or type = "screen"',
    fields: {
        contact_id: fields_1.contact_id,
        event_name: fields_1.event_name,
        timestamp: fields_1.timestamp,
        timezone: fields_1.timezone,
        metadata: fields_1.metadata,
        event_id: fields_1.event_id
    },
    perform: (request, { payload, settings }) => {
        const { contact_id, event_name, timestamp, timezone, metadata, event_id } = payload;
        const json = {
            contact_id,
            event_name,
            timestamp: new Date(timestamp).getTime() / 1000,
            timezone,
            event_id,
            metadata
        };
        return request(`${settings.region}events`, {
            method: 'post',
            json
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map