"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    TreeCollectionTemplate: ()=>TreeCollectionTemplate
});
const CollectionTemplate_js_namespaceObject = require("../../data-source/collection-template/CollectionTemplate.js");
const index_js_namespaceObject = require("./properties/index.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class TreeCollectionTemplate extends CollectionTemplate_js_namespaceObject.CollectionTemplate {
    constructor(...args){
        super(...args), _define_property(this, "name", 'tree'), _define_property(this, "title", '{{t("Tree collection")}}'), _define_property(this, "order", 3), _define_property(this, "color", 'blue'), _define_property(this, "default", {
            tree: 'adjacencyList',
            fields: [
                {
                    interface: 'integer',
                    name: 'parentId',
                    type: 'bigInt',
                    isForeignKey: true,
                    uiSchema: {
                        type: 'number',
                        title: '{{t("Parent ID")}}',
                        'x-component': 'InputNumber',
                        'x-read-pretty': true
                    }
                },
                {
                    interface: 'm2o',
                    type: 'belongsTo',
                    name: 'parent',
                    foreignKey: 'parentId',
                    treeParent: true,
                    onDelete: 'CASCADE',
                    uiSchema: {
                        title: '{{t("Parent")}}',
                        'x-component': 'AssociationField',
                        'x-component-props': {
                            multiple: false,
                            fieldNames: {
                                label: 'id',
                                value: 'id'
                            }
                        }
                    }
                },
                {
                    interface: 'o2m',
                    type: 'hasMany',
                    name: 'children',
                    foreignKey: 'parentId',
                    treeChildren: true,
                    onDelete: 'CASCADE',
                    uiSchema: {
                        title: '{{t("Children")}}',
                        'x-component': 'AssociationField',
                        'x-component-props': {
                            multiple: true,
                            fieldNames: {
                                label: 'id',
                                value: 'id'
                            }
                        }
                    }
                }
            ]
        }), _define_property(this, "events", {
            beforeSubmit (values) {
                if (Array.isArray(null == values ? void 0 : values.fields)) null == values || values.fields.map((f)=>{
                    f.target = values.name;
                });
            }
        }), _define_property(this, "configurableProperties", (0, index_js_namespaceObject.getConfigurableProperties)('title', 'name', 'inherits', 'category', "description", 'presetFields'));
    }
}
exports.TreeCollectionTemplate = __webpack_exports__.TreeCollectionTemplate;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "TreeCollectionTemplate"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
