// (C) 2025-2026 GoodData Corporation
import { useMemo } from "react";
import { compact } from "lodash-es";
import { useFiltersByTabNamings, useFiltersNamings } from "../../hooks/useFiltersNamings.js";
export const useAutomationVisibleFilters = (availableFilters = []) => {
    const filterNamings = useFiltersNamings(availableFilters);
    return useMemo(() => {
        return compact(filterNamings).map((filter) => {
            return {
                title: filter.title,
                localIdentifier: filter.id,
                isAllTimeDateFilter: false,
            };
        });
    }, [filterNamings]);
};
export const useAutomationVisibleFiltersByTab = (availableFilters = {}) => {
    const filterNamings = useFiltersByTabNamings(availableFilters);
    return useMemo(() => {
        const result = {};
        return Object.entries(filterNamings).reduce((acc, [tabId, namings]) => {
            acc[tabId] = compact(namings).map((naming) => ({
                title: naming.title,
                localIdentifier: naming.id,
                isAllTimeDateFilter: false,
            }));
            return acc;
        }, result);
    }, [filterNamings]);
};
