"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateConsentObject = exports.consent = exports.properties = exports.event_name = exports.message_id = exports.timestamp = exports.engage_space = exports.traits = exports.group_id = exports.anonymous_id = exports.user_id = void 0;
exports.user_id = {
    label: 'User ID',
    description: 'Unique identifier for the user in your database. A userId or an anonymousId is required.',
    type: 'string'
};
exports.anonymous_id = {
    label: 'Anonymous ID',
    description: 'A pseudo-unique substitute for a User ID, for cases when you don’t have an absolutely unique identifier. A userId or an anonymousId is required.',
    type: 'string'
};
exports.group_id = {
    label: 'Group ID',
    description: 'The group or account ID a user is associated with.',
    type: 'string'
};
exports.traits = {
    label: 'Traits',
    description: 'Free-form dictionary of traits that describe the user or group of users.',
    type: 'object',
    defaultObjectUI: 'keyvalue',
    additionalProperties: true
};
exports.engage_space = {
    label: 'Profile Space',
    description: 'The Profile Space to use for creating a record. *Note: This field shows list of internal sources associated with the Profile Space. Changes made to the Profile Space name in **Settings** will not reflect in this list unless the source associated with the Profile Space is renamed explicitly.*',
    type: 'string',
    required: true,
    dynamic: true
};
exports.timestamp = {
    label: 'Timestamp',
    description: 'The timestamp of the event.',
    type: 'datetime',
    default: {
        '@path': '$.timestamp'
    }
};
exports.message_id = {
    type: 'string',
    label: 'MessageId',
    description: 'The Segment messageId.',
    default: { '@path': '$.messageId' },
    unsafe_hidden: true
};
exports.event_name = {
    label: 'Event Name',
    description: 'Name of the action that a user has performed.',
    type: 'string',
    required: true
};
exports.properties = {
    label: 'Properties',
    description: 'Free-form dictionary of properties that describe the event.',
    type: 'object',
    defaultObjectUI: 'keyvalue',
    additionalProperties: true
};
exports.consent = {
    label: 'Consent',
    description: 'Segment event consent category preferences.',
    type: 'object',
    default: { '@path': '$.context.consent' },
    unsafe_hidden: true
};
function isCategoryPreferences(obj) {
    if (typeof obj !== 'object' || obj === null) {
        return false;
    }
    return Object.values(obj).every((value) => typeof value === 'boolean');
}
const validateConsentObject = (obj) => {
    if (obj == undefined) {
        return true;
    }
    if (typeof obj !== 'object' || obj === null) {
        throw false;
    }
    return 'categoryPreferences' in obj && isCategoryPreferences(obj['categoryPreferences']);
};
exports.validateConsentObject = validateConsentObject;
//# sourceMappingURL=segment-properties.js.map