import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../application/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__modules_actions_link_customizeLinkActionSettings_mjs__ from "../../modules/actions/link/customizeLinkActionSettings.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__ModalActionSchemaInitializerItem_mjs__ from "./ModalActionSchemaInitializerItem.mjs";
const quickAccessActionSettingsCustomRequest = new __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.SchemaSettings({
    name: 'quickAccess:actionSettings:customRequest',
    items: [
        {
            name: 'editButton',
            Component: __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.ButtonEditor,
            useComponentProps () {
                return {
                    hasIconColor: true
                };
            }
        },
        {
            name: 'editLink',
            Component: __WEBPACK_EXTERNAL_MODULE__modules_actions_link_customizeLinkActionSettings_mjs__.SchemaSettingsActionLinkItem
        },
        {
            sort: 800,
            name: 'd1',
            type: 'divider'
        },
        {
            sort: 900,
            type: 'remove',
            name: 'remove'
        }
    ]
});
function QuickAccessCustomRequestActionSchemaInitializerItem(props) {
    const { insert } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializer)();
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ModalActionSchemaInitializerItem_mjs__.ModalActionSchemaInitializerItem, {
        title: t('Custom request'),
        modalSchema: {
            title: t('Add custom request'),
            properties: {
                title: {
                    title: t('Title'),
                    required: true,
                    'x-component': 'Input',
                    'x-decorator': 'FormItem'
                },
                icon: {
                    title: t('Icon'),
                    required: true,
                    'x-component': 'IconPicker',
                    'x-decorator': 'FormItem'
                },
                iconColor: {
                    title: t('Color'),
                    required: true,
                    default: '#1677FF',
                    'x-component': 'ColorPicker',
                    'x-decorator': 'FormItem'
                }
            }
        },
        onSubmit: (values)=>{
            insert({
                type: 'void',
                title: values.title,
                'x-component': 'QuickAccessAction',
                'x-component-props': {
                    icon: values.icon,
                    iconColor: values.iconColor,
                    targetComponent: 'CustomRequestAction'
                },
                'x-action': 'customize:form:request',
                'x-toolbar': 'ActionSchemaToolbar',
                'x-settings': 'actionSettings:customRequest',
                'x-decorator': 'CustomRequestAction.Decorator',
                'x-action-settings': {
                    onSuccess: {
                        manualClose: false,
                        redirecting: false,
                        successMessage: '{{t("Request success")}}'
                    }
                }
            });
        }
    });
}
export { QuickAccessCustomRequestActionSchemaInitializerItem, quickAccessActionSettingsCustomRequest };
