import { cloneDeep } from "lodash";
import { CollectionFieldInterface } from "../../data-source/collection-field-interface/CollectionFieldInterface.mjs";
import { defaultProps, recordPickerViewer } 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 CreatedByFieldInterface extends CollectionFieldInterface {
    schemaInitialize(schema, param) {
        let { block } = param;
        schema['properties'] = {
            viewer: cloneDeep(recordPickerViewer)
        };
        if ([
            'Table',
            'Kanban'
        ].includes(block)) {
            schema['x-component-props'] = schema['x-component-props'] || {};
            schema['x-component-props']['ellipsis'] = true;
        }
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'createdBy'), _define_property(this, "type", 'object'), _define_property(this, "group", 'systemInfo'), _define_property(this, "order", 3), _define_property(this, "title", '{{t("Created by")}}'), _define_property(this, "icon", 'UserOutlined'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            type: 'belongsTo',
            target: 'users',
            foreignKey: 'createdById',
            uiSchema: {
                type: 'object',
                title: '{{t("Created by")}}',
                'x-component': 'AssociationField',
                'x-component-props': {
                    fieldNames: {
                        value: 'id',
                        label: 'nickname'
                    }
                },
                'x-read-pretty': true
            }
        }), _define_property(this, "availableTypes", [
            'belongsTo'
        ]), _define_property(this, "properties", {
            ...defaultProps
        }), _define_property(this, "filterable", {
            nested: true,
            children: []
        });
    }
}
export { CreatedByFieldInterface };
