"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBasicType = exports.isCustomIcon = exports.isEmojiIcon = exports.UNASSIGNED_OWNER = exports.UNCATEGORIZED_TAG_UUID = exports.CatalogCategoryFilterMode = exports.CatalogFilter = exports.CatalogType = void 0;
const tslib_1 = require("tslib");
const assertUnreachable_1 = tslib_1.__importDefault(require("../utils/assertUnreachable"));
const field_1 = require("./field");
var CatalogType;
(function (CatalogType) {
    CatalogType["Table"] = "table";
    CatalogType["Field"] = "field";
})(CatalogType || (exports.CatalogType = CatalogType = {}));
var CatalogFilter;
(function (CatalogFilter) {
    CatalogFilter["Tables"] = "tables";
    CatalogFilter["Dimensions"] = "dimensions";
    CatalogFilter["Metrics"] = "metrics";
})(CatalogFilter || (exports.CatalogFilter = CatalogFilter = {}));
var CatalogCategoryFilterMode;
(function (CatalogCategoryFilterMode) {
    CatalogCategoryFilterMode["AND"] = "and";
    CatalogCategoryFilterMode["OR"] = "or";
})(CatalogCategoryFilterMode || (exports.CatalogCategoryFilterMode = CatalogCategoryFilterMode = {}));
exports.UNCATEGORIZED_TAG_UUID = '__uncategorized__';
exports.UNASSIGNED_OWNER = '__unassigned__';
const isEmojiIcon = (icon) => Boolean(icon && 'unicode' in icon);
exports.isEmojiIcon = isEmojiIcon;
const isCustomIcon = (icon) => Boolean(icon && 'url' in icon);
exports.isCustomIcon = isCustomIcon;
const getBasicType = (field) => {
    const { type } = field;
    switch (type) {
        case field_1.DimensionType.STRING:
        case field_1.MetricType.STRING:
            return 'string';
        case field_1.DimensionType.NUMBER:
        case field_1.MetricType.NUMBER:
        case field_1.MetricType.PERCENTILE:
        case field_1.MetricType.MEDIAN:
        case field_1.MetricType.AVERAGE:
        case field_1.MetricType.COUNT:
        case field_1.MetricType.COUNT_DISTINCT:
        case field_1.MetricType.SUM:
        case field_1.MetricType.SUM_DISTINCT:
        case field_1.MetricType.AVERAGE_DISTINCT:
        case field_1.MetricType.MIN:
        case field_1.MetricType.MAX:
        case field_1.MetricType.PERCENT_OF_PREVIOUS:
        case field_1.MetricType.PERCENT_OF_TOTAL:
        case field_1.MetricType.RUNNING_TOTAL:
            return 'number';
        case field_1.DimensionType.DATE:
        case field_1.MetricType.DATE:
            return 'date';
        case field_1.DimensionType.TIMESTAMP:
        case field_1.MetricType.TIMESTAMP:
            return 'timestamp';
        case field_1.DimensionType.BOOLEAN:
        case field_1.MetricType.BOOLEAN:
            return 'boolean';
        default:
            return (0, assertUnreachable_1.default)(type, `Invalid field type ${type}`);
    }
};
exports.getBasicType = getBasicType;
//# sourceMappingURL=catalog.js.map