"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultEventFields = void 0;
exports.sendEvent = sendEvent;
exports.defaultEventFields = {
    agent: {
        label: 'Agent',
        type: 'string',
        required: false,
        description: 'Optional agent identifier that originated the event. Used to identify which SDK generated the event.',
        default: {
            '@if': {
                exists: { '@path': '$.context.library.name' },
                then: { '@path': '$.context.library.name' },
                else: 'segment'
            }
        }
    },
    application: {
        label: 'Application',
        type: 'string',
        required: false,
        description: 'Optional application name that originated this event. Must exist if not empty. Create Applications in the Settings > Applications section of the ABsmartly Web Console'
    }
};
function sendEvent(request, settings, event, agent, application) {
    agent = agent?.trim() ?? '';
    application = application?.trim() ?? '';
    const headers = {
        'X-Agent': agent.length > 0 ? agent : 'segment'
    };
    if (application !== '') {
        headers['X-Application'] = application;
        headers['X-Application-Version'] = '0';
    }
    return request(`${settings.collectorEndpoint}/context`, {
        method: 'put',
        headers,
        json: event
    });
}
//# sourceMappingURL=event.js.map