import { jsx } from "react/jsx-runtime";
import { useContext } from "react";
import { useFieldSchema } from "@tachybase/schema";
import { useTranslation } from "react-i18next";
import { SchemaComponentContext, createDesignable } from "../../index.mjs";
import { useAPIClient } from "../../../api-client/index.mjs";
import { SchemaInitializerItem, useSchemaInitializerItem } from "../../../application/index.mjs";
const AssociationFilterDesignerDelete = ()=>{
    const itemConfig = useSchemaInitializerItem();
    const { refresh } = useContext(SchemaComponentContext);
    const fieldSchema = useFieldSchema();
    const api = useAPIClient();
    const { t } = useTranslation();
    const dn = createDesignable({
        t,
        api,
        refresh,
        current: fieldSchema
    });
    dn.loadAPIClientEvents();
    const handleClick = ()=>{
        dn.remove(fieldSchema);
    };
    return /*#__PURE__*/ jsx(SchemaInitializerItem, {
        onClick: handleClick,
        children: /*#__PURE__*/ jsx("div", {
            children: itemConfig.title
        })
    });
};
export { AssociationFilterDesignerDelete };
