"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssociationCategory = exports.SearchFilterOperator = void 0;
exports.flattenObject = flattenObject;
exports.transformEventName = transformEventName;
function flattenObject(obj) {
    if (typeof obj === 'undefined' || obj === null)
        return obj;
    const flattened = {};
    Object.keys(obj).forEach((key) => {
        if (typeof obj[key] === 'undefined' || obj[key] == null || !Object.prototype.hasOwnProperty.call(obj, key)) {
            return;
        }
        if (obj[key] instanceof Array) {
            flattened[key] = obj[key]
                .map((item) => (typeof item === 'object' ? JSON.stringify(item) : item))
                .join(';');
            return;
        }
        if (typeof obj[key] === 'object') {
            flattened[key] = JSON.stringify(obj[key]);
            return;
        }
        if (typeof obj[key] === 'string') {
            flattened[key] = obj[key].trim();
            return;
        }
        flattened[key] = obj[key];
    });
    return flattened;
}
var SearchFilterOperator;
(function (SearchFilterOperator) {
    SearchFilterOperator["EQ"] = "EQ";
    SearchFilterOperator["NEQ"] = "NEQ";
    SearchFilterOperator["LT"] = "LT";
    SearchFilterOperator["LTE"] = "LTE";
    SearchFilterOperator["GT"] = "GT";
    SearchFilterOperator["GTE"] = "GTE";
    SearchFilterOperator["BETWEEN"] = "BETWEEN";
    SearchFilterOperator["IN"] = "IN";
    SearchFilterOperator["NOT_IN"] = "NOT_IN";
    SearchFilterOperator["HAS_PROPERTY"] = "HAS_PROPERTY";
    SearchFilterOperator["NOT_HAS_PROPERTY"] = "NOT_HAS_PROPERTY";
    SearchFilterOperator["CONTAINS_TOKEN"] = "CONTAINS_TOKEN";
    SearchFilterOperator["NOT_CONTAINS_TOKEN"] = "NOT_CONTAINS_TOKEN";
})(SearchFilterOperator || (exports.SearchFilterOperator = SearchFilterOperator = {}));
function transformEventName(eventName) {
    return eventName.replace(/[\s.]+/g, '_').toLocaleLowerCase();
}
var AssociationCategory;
(function (AssociationCategory) {
    AssociationCategory["HUBSPOT_DEFINED"] = "HUBSPOT_DEFINED";
    AssociationCategory["USER_DEFINED"] = "USER_DEFINED";
    AssociationCategory["INTEGRATOR_DEFINED"] = "INTEGRATOR_DEFINED";
})(AssociationCategory || (exports.AssociationCategory = AssociationCategory = {}));
//# sourceMappingURL=utils.js.map