import { jsx } from "react/jsx-runtime";
import "react";
import { TableOutlined } from "@ant-design/icons";
import { useSchemaInitializer, useSchemaInitializerItem } from "../../../../application/index.mjs";
import { DataBlockInitializer } from "../../../../schema-initializer/items/DataBlockInitializer.mjs";
import { createCollapseBlockSchema } from "./createFilterCollapseBlockSchema.mjs";
const FilterCollapseBlockInitializer = (param)=>{
    let { filterCollections, onlyCurrentDataSource, hideChildrenIfSingleCollection } = param;
    const itemConfig = useSchemaInitializerItem();
    const { insert } = useSchemaInitializer();
    return /*#__PURE__*/ jsx(DataBlockInitializer, {
        ...itemConfig,
        onlyCurrentDataSource: onlyCurrentDataSource,
        icon: /*#__PURE__*/ jsx(TableOutlined, {}),
        componentType: 'FilterCollapse',
        onCreateBlockSchema: async (param)=>{
            let { item } = param;
            const schema = createCollapseBlockSchema({
                dataSource: item.dataSource,
                collectionName: item.collectionName || item.name,
                blockType: 'filter'
            });
            insert(schema);
        },
        filter: filterCollections,
        hideChildrenIfSingleCollection: hideChildrenIfSingleCollection
    });
};
export { FilterCollapseBlockInitializer };
