// (C) 2007-2026 GoodData Corporation
import { isEmpty } from "lodash-es";
import { isAttributeFilter, isDateFilter, isMeasureValueFilter, } from "@gooddata/sdk-model";
/**
 * Type-guard testing whether the provided object is an instance of {@link IDashboardFilter}.
 *
 * @alpha
 */
export function isDashboardFilter(obj) {
    return isAttributeFilter(obj) || isDateFilter(obj) || isMeasureValueFilter(obj);
}
/**
 * Type-guard testing whether the provided object is an instance of {@link IDrillDownDefinition}.
 * @beta
 */
export function isDrillDownDefinition(obj) {
    return !isEmpty(obj) && obj.type === "drillDown";
}
/**
 * Tests whether the provided density is supported.
 *
 * @param density
 *
 * @alpha
 */
export function isSupportedDashboardDensity(density) {
    return density === "comfortable" || density === "compact";
}
/**
 *  Tests whenever the provided object is layout coordinates object.
 *  @alpha
 */
export function isLayoutCoordinates(obj) {
    return (!isEmpty(obj) &&
        obj.sectionIndex !== undefined &&
        obj.itemIndex !== undefined);
}
/**
 *  Tests whenever the provided object is section path.
 *  @alpha
 */
export function isLayoutItemPath(obj) {
    return !isEmpty(obj) && Array.isArray(obj) && obj.every(isLayoutCoordinates);
}
/**
 *  Tests whenever the provided object is section path.
 *  @alpha
 */
export function isLayoutSectionPath(obj) {
    return !isEmpty(obj) && obj.sectionIndex !== undefined;
}
