import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
function createEditFormBlockUISchema(options) {
    const { collectionName, dataSource, association, templateSchema } = options;
    const resourceName = association || collectionName;
    const isCurrentObj = options.isCurrent ? {
        'x-is-current': true
    } : {};
    if (!dataSource) throw new Error('dataSource are required');
    return {
        type: 'void',
        'x-acl-action-props': {
            skipScopeCheck: false
        },
        'x-acl-action': "".concat(resourceName, ":update"),
        'x-decorator': 'FormBlockProvider',
        'x-use-decorator-props': 'useEditFormBlockDecoratorProps',
        'x-decorator-props': {
            action: 'get',
            dataSource,
            collection: collectionName,
            association
        },
        'x-toolbar': 'BlockSchemaToolbar',
        'x-settings': 'blockSettings:editForm',
        'x-component': 'CardItem',
        ...isCurrentObj,
        properties: {
            [(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
                type: 'void',
                'x-component': 'FormV2',
                'x-use-component-props': 'useEditFormBlockProps',
                properties: {
                    [(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
                        type: 'void',
                        'x-initializer': 'editForm:configureActions',
                        'x-component': 'ActionBar',
                        'x-component-props': {
                            style: {
                                marginBottom: 'var(--tb-spacing)'
                            }
                        }
                    },
                    grid: templateSchema || {
                        type: 'void',
                        'x-component': 'Grid',
                        'x-initializer': 'form:configureFields',
                        properties: {}
                    }
                }
            }
        }
    };
}
export { createEditFormBlockUISchema };
