import { jsx, jsxs } from "react/jsx-runtime";
import "react";
import { useFieldSchema } from "@tachybase/schema";
import { useTranslation } from "react-i18next";
import { useCollection_deprecated } from "../../../collection-manager/index.mjs";
import { FilterBlockType } from "../../../filter-provider/utils.mjs";
import { GeneralSchemaDesigner, SchemaSettingsBlockTitleItem, SchemaSettingsConnectDataBlocks, SchemaSettingsDivider, SchemaSettingsRemove, SchemaSettingsTemplate } from "../../../schema-settings/index.mjs";
import { useSchemaTemplate } from "../../../schema-templates/index.mjs";
const AssociationFilterBlockDesigner = ()=>{
    var _fieldSchema_xdecoratorprops, _fieldSchema_xdecoratorprops1;
    const { name, title } = useCollection_deprecated();
    const template = useSchemaTemplate();
    const fieldSchema = useFieldSchema();
    const { t } = useTranslation();
    const defaultResource = (null == fieldSchema ? void 0 : null == (_fieldSchema_xdecoratorprops = fieldSchema['x-decorator-props']) ? void 0 : _fieldSchema_xdecoratorprops.resource) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xdecoratorprops1 = fieldSchema['x-decorator-props']) ? void 0 : _fieldSchema_xdecoratorprops1.association);
    return /*#__PURE__*/ jsxs(GeneralSchemaDesigner, {
        template: template,
        title: title || name,
        children: [
            /*#__PURE__*/ jsx(SchemaSettingsBlockTitleItem, {}),
            /*#__PURE__*/ jsx(SchemaSettingsTemplate, {
                componentName: 'FilterCollapse',
                collectionName: name,
                resourceName: defaultResource
            }),
            /*#__PURE__*/ jsx(SchemaSettingsConnectDataBlocks, {
                type: FilterBlockType.COLLAPSE,
                emptyDescription: t('No blocks to connect')
            }),
            /*#__PURE__*/ jsx(SchemaSettingsDivider, {}),
            /*#__PURE__*/ jsx(SchemaSettingsRemove, {
                removeParentsIfNoChildren: true,
                breakRemoveOn: {
                    'x-component': 'Grid'
                }
            })
        ]
    });
};
export { AssociationFilterBlockDesigner };
