"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__, {
    OBOFieldInterface: ()=>OBOFieldInterface,
    O2OFieldInterface: ()=>O2OFieldInterface,
    OHOFieldInterface: ()=>OHOFieldInterface
});
const CollectionFieldInterface_js_namespaceObject = require("../../data-source/collection-field-interface/CollectionFieldInterface.js");
const external_o2m_js_namespaceObject = require("./o2m.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 O2OFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    schemaInitialize(schema, param) {
        let { field, block, readPretty, action, targetCollection } = param;
        if ([
            'Table',
            'Kanban'
        ].includes(block)) {
            schema['x-component-props'] = schema['x-component-props'] || {};
            schema['x-component-props']['ellipsis'] = true;
            schema['x-component-props']['size'] = 'small';
        }
        schema['x-component-props'] = schema['x-component-props'] || {};
        schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
            value: (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection)
        };
        schema['x-component-props'].fieldNames.label = (null == targetCollection ? void 0 : targetCollection.titleField) || (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection);
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'o2o'), _define_property(this, "type", 'object'), _define_property(this, "group", 'relation'), _define_property(this, "order", 3), _define_property(this, "icon", 'DeploymentUnitOutlined'), _define_property(this, "title", '{{t("One to one")}}'), _define_property(this, "description", '{{t("One to one description")}}'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            type: 'hasOne',
            uiSchema: {
                'x-component': 'AssociationField',
                'x-component-props': {
                    multiple: false
                }
            },
            reverseField: {
                interface: 'obo',
                type: 'belongsTo',
                uiSchema: {
                    'x-component': 'AssociationField',
                    'x-component-props': {
                        multiple: false
                    }
                }
            }
        }), _define_property(this, "availableTypes", [
            'hasOne'
        ]), _define_property(this, "properties", {
            'uiSchema.title': {
                type: 'string',
                title: '{{t("Field display name")}}',
                required: true,
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            },
            name: {
                type: 'string',
                title: '{{t("Field name")}}',
                required: true,
                'x-disabled': '{{ !createOnly }}',
                'x-decorator': 'FormItem',
                'x-component': 'Input',
                description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
            },
            type: index_js_namespaceObject.relationshipType,
            grid: {
                type: 'void',
                'x-component': 'Grid',
                properties: {
                    row1: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col11: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    source: {
                                        type: 'void',
                                        title: '{{t("Source collection")}}',
                                        'x-decorator': 'FormItem',
                                        'x-component': 'SourceCollection',
                                        'x-disabled': true
                                    }
                                }
                            },
                            col12: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    target: {
                                        type: 'string',
                                        title: '{{t("Target collection")}}',
                                        required: true,
                                        'x-reactions': [
                                            '{{useAsyncDataSource(loadCollections, ["file"])}}'
                                        ],
                                        'x-decorator': 'FormItem',
                                        'x-component': 'Select',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    },
                    row2: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col21: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    sourceKey: {
                                        type: 'string',
                                        title: '{{t("Source key")}}',
                                        description: "{{t('Field values must be unique.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'SourceKey'
                                    }
                                }
                            },
                            col22: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    foreignKey: {
                                        type: 'string',
                                        title: '{{t("Foreign key")}}',
                                        required: true,
                                        default: '{{ useNewId("f_") }}',
                                        description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'ForeignKey',
                                        'x-validator': 'uid',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            'reverseField.name': {
                type: 'string',
                title: '{{t("Inverse field name")}}',
                'x-hidden': '{{ !createOnly }}',
                'x-decorator': 'FormItem',
                'x-component': 'Input',
                description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
            }
        }), _define_property(this, "filterable", {
            nested: true,
            operators: index_js_namespaceObject.operators.collectionField,
            children: []
        });
    }
}
class OHOFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    schemaInitialize(schema, param) {
        let { field, block, readPretty, action, targetCollection } = param;
        var _schema_xcomponentprops_fieldNames;
        if ([
            'Table',
            'Kanban'
        ].includes(block)) {
            schema['x-component-props'] = schema['x-component-props'] || {};
            schema['x-component-props']['ellipsis'] = true;
            schema['x-component-props']['size'] = 'small';
        }
        schema['x-component-props'] = schema['x-component-props'] || {};
        schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
            value: (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection)
        };
        schema['x-component-props'].fieldNames.label = (null == (_schema_xcomponentprops_fieldNames = schema['x-component-props'].fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.label) || (null == targetCollection ? void 0 : targetCollection.titleField) || (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection);
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'oho'), _define_property(this, "type", 'object'), _define_property(this, "group", 'relation'), _define_property(this, "order", 3), _define_property(this, "title", '{{t("One to one (has one)")}}'), _define_property(this, "description", '{{t("One to one description")}}'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            type: 'hasOne',
            uiSchema: {
                'x-component': 'AssociationField',
                'x-component-props': {
                    multiple: false
                }
            },
            reverseField: {
                interface: 'obo',
                type: 'belongsTo',
                uiSchema: {
                    'x-component': 'AssociationField',
                    'x-component-props': {
                        multiple: false
                    }
                }
            }
        }), _define_property(this, "availableTypes", [
            'hasOne'
        ]), _define_property(this, "properties", {
            'uiSchema.title': {
                type: 'string',
                title: '{{t("Field display name")}}',
                required: true,
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            },
            name: {
                type: 'string',
                title: '{{t("Field name")}}',
                required: true,
                'x-disabled': '{{ !createOnly }}',
                'x-decorator': 'FormItem',
                'x-component': 'Input',
                description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
            },
            type: index_js_namespaceObject.relationshipType,
            grid: {
                type: 'void',
                'x-component': 'Grid',
                properties: {
                    row1: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col11: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    source: {
                                        type: 'void',
                                        title: '{{t("Source collection")}}',
                                        'x-decorator': 'FormItem',
                                        'x-component': 'SourceCollection',
                                        'x-disabled': true
                                    }
                                }
                            },
                            col12: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    target: {
                                        type: 'string',
                                        title: '{{t("Target collection")}}',
                                        required: true,
                                        'x-reactions': [
                                            '{{useAsyncDataSource(loadCollections, ["file"])}}'
                                        ],
                                        'x-decorator': 'FormItem',
                                        'x-component': 'Select',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    },
                    row2: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col21: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    sourceKey: {
                                        type: 'string',
                                        title: '{{t("Source key")}}',
                                        description: "{{t('Field values must be unique.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'SourceKey'
                                    }
                                }
                            },
                            col22: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    foreignKey: {
                                        type: 'string',
                                        title: '{{t("Foreign key")}}',
                                        required: true,
                                        default: '{{ useNewId("f_") }}',
                                        description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'ForeignKey',
                                        'x-validator': 'uid',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            ...index_js_namespaceObject.constraintsProps,
            ...index_js_namespaceObject.reverseFieldProperties
        }), _define_property(this, "filterable", {
            nested: true,
            operators: index_js_namespaceObject.operators.collectionField,
            children: []
        });
    }
}
class OBOFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    schemaInitialize(schema, param) {
        let { field, block, readPretty, action, targetCollection } = param;
        var _schema_xcomponentprops_fieldNames;
        if ([
            'Table',
            'Kanban'
        ].includes(block)) {
            schema['x-component-props'] = schema['x-component-props'] || {};
            schema['x-component-props']['ellipsis'] = true;
            schema['x-component-props']['size'] = 'small';
        }
        schema['x-component-props'] = schema['x-component-props'] || {};
        schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
            value: (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection)
        };
        schema['x-component-props'].fieldNames.label = (null == (_schema_xcomponentprops_fieldNames = schema['x-component-props'].fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.label) || (null == targetCollection ? void 0 : targetCollection.titleField) || (0, external_o2m_js_namespaceObject.getUniqueKeyFromCollection)(targetCollection);
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'obo'), _define_property(this, "type", 'object'), _define_property(this, "group", 'relation'), _define_property(this, "order", 3), _define_property(this, "title", '{{t("One to one (belongs to)")}}'), _define_property(this, "description", '{{t("One to one description")}}'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            type: 'belongsTo',
            uiSchema: {
                'x-component': 'AssociationField',
                'x-component-props': {
                    multiple: false
                }
            },
            reverseField: {
                interface: 'oho',
                type: 'hasOne',
                uiSchema: {
                    'x-component': 'AssociationField',
                    'x-component-props': {
                        multiple: false
                    }
                }
            }
        }), _define_property(this, "availableTypes", [
            'hasOne'
        ]), _define_property(this, "properties", {
            'uiSchema.title': {
                type: 'string',
                title: '{{t("Field display name")}}',
                required: true,
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            },
            name: {
                type: 'string',
                title: '{{t("Field name")}}',
                required: true,
                'x-disabled': '{{ !createOnly }}',
                'x-decorator': 'FormItem',
                'x-component': 'Input',
                description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
            },
            type: index_js_namespaceObject.relationshipType,
            grid: {
                type: 'void',
                'x-component': 'Grid',
                properties: {
                    row1: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col11: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    source: {
                                        type: 'void',
                                        title: '{{t("Source collection")}}',
                                        'x-decorator': 'FormItem',
                                        'x-component': 'SourceCollection',
                                        'x-disabled': true
                                    }
                                }
                            },
                            col12: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    target: {
                                        type: 'string',
                                        title: '{{t("Target collection")}}',
                                        required: true,
                                        'x-reactions': [
                                            '{{useAsyncDataSource(loadCollections)}}'
                                        ],
                                        'x-decorator': 'FormItem',
                                        'x-component': 'Select',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    },
                    row2: {
                        type: 'void',
                        'x-component': 'Grid.Row',
                        properties: {
                            col21: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    foreignKey: {
                                        type: 'string',
                                        title: '{{t("Foreign key")}}',
                                        required: true,
                                        default: '{{ useNewId("f_") }}',
                                        description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'ForeignKey',
                                        'x-validator': 'uid',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            },
                            col22: {
                                type: 'void',
                                'x-component': 'Grid.Col',
                                properties: {
                                    targetKey: {
                                        type: 'string',
                                        title: '{{t("Target key")}}',
                                        description: "{{t('Field values must be unique.')}}",
                                        'x-decorator': 'FormItem',
                                        'x-component': 'TargetKey',
                                        'x-disabled': '{{ !createOnly }}'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            ...index_js_namespaceObject.constraintsProps,
            ...index_js_namespaceObject.reverseFieldProperties
        }), _define_property(this, "filterable", {
            nested: true,
            operators: index_js_namespaceObject.operators.collectionField,
            children: []
        });
    }
}
exports.O2OFieldInterface = __webpack_exports__.O2OFieldInterface;
exports.OBOFieldInterface = __webpack_exports__.OBOFieldInterface;
exports.OHOFieldInterface = __webpack_exports__.OHOFieldInterface;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "O2OFieldInterface",
    "OBOFieldInterface",
    "OHOFieldInterface"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
