import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
function createDetailsUISchema(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': "".concat(resourceName, ":get"),
        'x-decorator': 'DetailsBlockProvider',
        'x-use-decorator-props': 'useDetailsDecoratorProps',
        'x-decorator-props': {
            dataSource,
            collection: collectionName,
            association,
            readPretty: true,
            action: 'get'
        },
        'x-toolbar': 'BlockSchemaToolbar',
        'x-settings': 'blockSettings:details',
        'x-component': 'CardItem',
        ...isCurrentObj,
        properties: {
            [(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
                type: 'void',
                'x-component': 'Details',
                'x-read-pretty': true,
                'x-use-component-props': 'useDetailsProps',
                properties: {
                    [(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
                        type: 'void',
                        'x-initializer': 'details:configureActions',
                        'x-component': 'ActionBar',
                        'x-component-props': {
                            style: {
                                marginBottom: 24
                            }
                        },
                        properties: {}
                    },
                    grid: templateSchema || {
                        type: 'void',
                        'x-component': 'Grid',
                        'x-initializer': 'details:configureFields',
                        properties: {}
                    }
                }
            }
        }
    };
}
export { createDetailsUISchema };
