"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cordial_client_1 = __importDefault(require("../cordial-client"));
const identities_fields_1 = __importDefault(require("../identities-fields"));
const action = {
    title: 'Create Contactactivity',
    description: 'Create a new contact activity.',
    defaultSubscription: 'type = "track" or type = "page"',
    fields: {
        ...identities_fields_1.default,
        action: {
            label: 'Event name',
            description: 'Event name. Required.',
            type: 'string',
            required: true,
            default: {
                '@if': {
                    exists: { '@path': '$.event' },
                    then: { '@path': '$.event' },
                    else: 'pageView'
                }
            }
        },
        time: {
            label: 'Event timestamp',
            description: 'Event timestamp. Optional. Date format is ISO 8601 standard. If empty, the request upload time will be used. ',
            type: 'datetime',
            default: {
                '@path': '$.timestamp'
            }
        },
        properties: {
            label: 'Event properties',
            description: 'An object of additional event attributes. Optional.',
            type: 'object',
            default: {
                '@path': '$.properties'
            }
        },
        context: {
            label: 'Event context',
            description: 'Event context as it appears in Segment. Optional. We use context to capture event metadata like sender ip and device info.',
            type: 'object',
            default: {
                '@path': '$.context'
            }
        }
    },
    perform: (request, { settings, payload }) => {
        const client = new cordial_client_1.default(settings, request);
        return client.addContactActivity(payload);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map