import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
import { useIsAssociationField, useIsFieldReadPretty, useIsMuiltipleAble, useIsSelectFieldMode } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
import { useIsShowMultipleSwitch } from "../../../../schema-settings/hooks/useIsShowMultipleSwitch.mjs";
import { CustomTitle, allowMultiple, enableLink, fieldComponent, quickCreate, setDefaultSortingRules, setTheDataScope } from "../Select/selectComponentFieldSettings.mjs";
const CustomTitleComponentFieldSettings = new SchemaSettings({
    name: 'fieldSettings:component:CustomTitle',
    items: [
        {
            ...fieldComponent,
            useVisible: useIsMuiltipleAble
        },
        {
            ...CustomTitle,
            useVisible: useIsMuiltipleAble
        },
        {
            ...setTheDataScope,
            useVisible () {
                const isSelectFieldMode = useIsSelectFieldMode();
                const isFieldReadPretty = useIsFieldReadPretty();
                return isSelectFieldMode && !isFieldReadPretty;
            }
        },
        {
            ...setDefaultSortingRules,
            useComponentProps () {
                const { fieldSchema } = useColumnSchema();
                return {
                    fieldSchema
                };
            },
            useVisible () {
                const isSelectFieldMode = useIsSelectFieldMode();
                const isFieldReadPretty = useIsFieldReadPretty();
                return isSelectFieldMode && !isFieldReadPretty;
            }
        },
        {
            ...quickCreate,
            useVisible () {
                const isAssociationField = useIsAssociationField();
                const readPretty = useIsFieldReadPretty();
                const { fieldSchema } = useColumnSchema();
                return isAssociationField && !fieldSchema && !readPretty;
            }
        },
        {
            ...allowMultiple,
            useVisible () {
                const isAssociationField = useIsAssociationField();
                const IsShowMultipleSwitch = useIsShowMultipleSwitch();
                return isAssociationField && IsShowMultipleSwitch();
            }
        },
        {
            ...enableLink,
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                return useIsAssociationField() && readPretty;
            }
        }
    ]
});
export { CustomTitleComponentFieldSettings };
