// (C) 2019-2026 GoodData Corporation
/**
 * @public
 */
export function isAttributeHeader(header) {
    return header && header.attributeHeader !== undefined;
}
/**
 * @public
 */
export const isAfmObjectIdentifier = (value) => {
    return !!(value?.identifier?.id &&
        value?.identifier?.type);
};
/**
 * @public
 */
export const isAfmObjectLocalIdentifier = (value) => {
    return !!value?.localIdentifier;
};
/**
 * @public
 */
export function isResultAttributeHeader(header) {
    return header.attributeHeader !== undefined;
}
/**
 * @public
 */
export function isResultMeasureHeader(header) {
    return header.measureHeader !== undefined;
}
/**
 * @public
 */
export function isResultTotalHeader(header) {
    return header.totalHeader !== undefined;
}
/**
 * @public
 */
export function isVisualizationObjectsItem(visualizationObject) {
    return visualizationObject.type === "visualizationObject";
}
/**
 * @public
 */
export function isFilterContextData(filterContext) {
    return filterContext.type === "filterContext";
}
/**
 * @public
 */
export function isDashboardPluginsItem(dashboardPlugin) {
    return dashboardPlugin.type === "dashboardPlugin";
}
/**
 * @public
 */
export function isDataSetItem(dataSet) {
    return dataSet.type === "dataset";
}
/**
 * @public
 */
export function isLabelItem(label) {
    return label.type === "label";
}
/**
 * @public
 */
export function isAttributeItem(attribute) {
    return attribute.type === "attribute";
}
/**
 * @public
 */
export function isFactItem(fact) {
    return fact.type === "fact";
}
/**
 * @public
 */
export function isMetricItem(metric) {
    return metric.type === "metric";
}
/**
 * @public
 */
export function isTigerFilterContextItem(obj) {
    if (!obj || typeof obj !== "object") {
        return false;
    }
    if ("attributeFilter" in obj) {
        return isDashboardAttributeFilter(obj);
    }
    if ("dateFilter" in obj) {
        return isDashboardDateFilter(obj);
    }
    return false;
}
/**
 * @public
 */
export function isTigerFilterContextItems(filters) {
    return filters.every(isTigerFilterContextItem);
}
/**
 * @public
 */
export function isTigerFilter(obj) {
    return (isTigerDateFilter(obj) ||
        isTigerAttributeFilter(obj) ||
        isTigerMeasureValueFilter(obj) ||
        isTigerRankingFilter(obj));
}
/**
 * @public
 */
export function isTigerFilters(filters) {
    return filters.every(isTigerFilter);
}
function isTigerAttributeFilter(obj) {
    return isTigerPositiveAttributeFilter(obj) || isTigerNegativeAttributeFilter(obj);
}
function isTigerDateFilter(obj) {
    return isTigerAbsoluteDateFilter(obj) || isTigerRelativeDateFilter(obj);
}
function isTigerPositiveAttributeFilter(obj) {
    return !!obj && typeof obj === "object" && "positiveAttributeFilter" in obj;
}
function isTigerNegativeAttributeFilter(obj) {
    return !!obj && typeof obj === "object" && "negativeAttributeFilter" in obj;
}
function isTigerAbsoluteDateFilter(obj) {
    return !!obj && typeof obj === "object" && "absoluteDateFilter" in obj;
}
function isTigerRelativeDateFilter(obj) {
    return !!obj && typeof obj === "object" && "relativeDateFilter" in obj;
}
function isTigerMeasureValueFilter(obj) {
    return !!obj && typeof obj === "object" && "measureValueFilter" in obj;
}
function isTigerRankingFilter(obj) {
    return !!obj && typeof obj === "object" && "rankingFilter" in obj;
}
function isDashboardAttributeFilter(obj) {
    return isAfmObjectIdentifier(obj.attributeFilter?.displayForm);
}
function isDashboardDateFilter(obj) {
    const dateFilter = obj.dateFilter;
    return !!dateFilter;
}
//# sourceMappingURL=typeGuards.js.map