{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "maxLength": 100,
            "tooltip": true,
            "pattern": "$noBadCharacters"
        },
        "from": {
            "type": "varchar",
            "maxLength": 255,
            "tooltip": true
        },
        "to": {
            "type": "varchar",
            "maxLength": 255,
            "tooltip": true
        },
        "subject": {
            "type": "varchar",
            "maxLength": 255,
            "tooltip": true
        },
        "bodyContains": {
            "type": "array",
            "tooltip": true
        },
        "bodyContainsAll": {
            "type": "array",
            "tooltip": true
        },
        "isGlobal": {
            "type": "bool",
            "tooltip": true,
            "default": false,
            "readOnlyAfterCreate": true
        },
        "parent": {
            "type": "linkParent",
            "view": "views/email-filter/fields/parent",
            "readOnlyAfterCreate": true
        },
        "action": {
            "type": "enum",
            "default": "Skip",
            "options": [
                "Skip",
                "Move to Folder",
                "Move to Group Folder",
                "None"
            ]
        },
        "emailFolder": {
            "type": "link",
            "view": "views/email-filter/fields/email-folder"
        },
        "groupEmailFolder": {
            "type": "link"
        },
        "markAsRead": {
            "type": "bool"
        },
        "skipNotification": {
            "type": "bool"
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "parent": {
            "type": "belongsToParent",
            "entityList": [
                "User",
                "EmailAccount",
                "InboundEmail"
            ]
        },
        "emailFolder": {
            "type": "belongsTo",
            "entity": "EmailFolder"
        },
        "groupEmailFolder": {
            "type": "belongsTo",
            "entity": "GroupEmailFolder"
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc"
    }
}
