// (C) 2026 GoodData Corporation
import { dashboardAttributeFilterItemDisplayForm, dashboardFilterObjRef, isDashboardAttributeFilterItem, isDashboardMeasureValueFilter, } from "@gooddata/sdk-model";
/**
 * Converts filters to references.
 * @param filters - filters to convert to references
 * @returns references to the filters
 */
export function toDashboardFilterReferences(filters) {
    return filters?.map((filter) => {
        if (isDashboardAttributeFilterItem(filter)) {
            const filterReference = {
                type: "attributeFilterReference",
                displayForm: dashboardAttributeFilterItemDisplayForm(filter),
            };
            return filterReference;
        }
        if (isDashboardMeasureValueFilter(filter)) {
            const filterReference = {
                type: "measureValueFilterReference",
                measure: dashboardFilterObjRef(filter),
            };
            return filterReference;
        }
        const filterReference = {
            type: "dateFilterReference",
            dataSet: filter.dateFilter.dataSet,
        };
        return filterReference;
    });
}
