{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "pattern": "$noBadCharacters"
        },
        "order": {
            "type": "int",
            "minValue": 1
        },
        "description": {
            "type": "text"
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user"
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user"
        },
        "teams": {
            "type": "linkMultiple"
        },
        "parent": {
            "type": "link"
        },
        "childList": {
            "type": "jsonArray",
            "notStorable": true,
            "utility": true,
            "orderDisabled": true
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "parent": {
            "type": "belongsTo",
            "foreign": "children",
            "entity": "{entityType}",
            "isCustom": true
        },
        "children": {
            "type": "hasMany",
            "foreign": "parent",
            "entity": "{entityType}",
            "readOnly": true,
            "isCustom": true
        }
    },
    "collection": {
        "orderBy": "parent",
        "order": "asc"
    },
    "indexes": {
        "name": {
            "columns": [
                "name",
                "deleted"
            ]
        }
    },
    "additionalTables": {
        "{entityType}Path": {
            "attributes": {
                "id": {
                    "type": "id",
                    "dbType": "integer",
                    "len": 11,
                    "autoincrement": true,
                    "unique" : true
                },
                "ascendorId": {
                    "type": "foreignId",
                    "index": true
                },
                "descendorId": {
                    "type": "foreignId",
                    "index": true
                }
            }
        }
    }
}
