import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__data_source_collection_field_interface_CollectionFieldInterface_mjs__ from "../../data-source/collection-field-interface/CollectionFieldInterface.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__properties_index_mjs__ from "./properties/index.mjs";
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 ChinaRegionFieldInterface extends __WEBPACK_EXTERNAL_MODULE__data_source_collection_field_interface_CollectionFieldInterface_mjs__.CollectionFieldInterface {
    initialize(values) {
        if (!values.through) values.through = "t_".concat((0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)());
        if (!values.foreignKey) values.foreignKey = "f_".concat((0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)());
        if (!values.otherKey) values.otherKey = "f_".concat((0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)());
        if (!values.sourceKey) values.sourceKey = 'id';
        if (!values.targetKey) values.targetKey = 'id';
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'chinaRegion'), _define_property(this, "type", 'object'), _define_property(this, "group", 'choices'), _define_property(this, "order", 7), _define_property(this, "title", '{{t("China region")}}'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            interface: 'chinaRegion',
            type: 'belongsToMany',
            target: 'chinaRegions',
            targetKey: 'code',
            sortBy: 'level',
            uiSchema: {
                type: 'array',
                'x-component': 'Cascader',
                'x-component-props': {
                    useDataSource: '{{ useChinaRegionDataSource }}',
                    useLoadData: '{{ useChinaRegionLoadData }}',
                    changeOnSelectLast: false,
                    labelInValue: true,
                    maxLevel: 3,
                    fieldNames: {
                        label: 'name',
                        value: 'code',
                        children: 'children'
                    }
                }
            }
        }), _define_property(this, "availableTypes", [
            'belongsToMany'
        ]), _define_property(this, "properties", {
            ...__WEBPACK_EXTERNAL_MODULE__properties_index_mjs__.defaultProps,
            'uiSchema.x-component-props.maxLevel': {
                type: 'number',
                'x-component': 'Radio.Group',
                'x-decorator': 'FormItem',
                title: '{{t("Select level")}}',
                default: 3,
                enum: [
                    {
                        value: 1,
                        label: '{{t("Province")}}'
                    },
                    {
                        value: 2,
                        label: '{{t("City")}}'
                    },
                    {
                        value: 3,
                        label: '{{t("Area")}}'
                    },
                    {
                        value: 4,
                        label: '{{t("Street")}}',
                        disabled: true
                    },
                    {
                        value: 5,
                        label: '{{t("Village")}}',
                        disabled: true
                    }
                ]
            },
            'uiSchema.x-component-props.changeOnSelectLast': {
                type: 'boolean',
                'x-component': 'Checkbox',
                'x-content': '{{t("Must select to the last level")}}',
                'x-decorator': 'FormItem'
            }
        }), _define_property(this, "filterable", {
            children: [
                {
                    name: 'name',
                    title: '{{t("Province/city/area name")}}',
                    operators: __WEBPACK_EXTERNAL_MODULE__properties_index_mjs__.operators.string,
                    schema: {
                        title: '{{t("Province/city/area name")}}',
                        type: 'string',
                        'x-component': 'Input'
                    }
                }
            ]
        });
    }
}
export { ChinaRegionFieldInterface };
