{
    "fields": {
        "name": {
            "type": "varchar",
            "maxLength": 255,
            "required": true
        },
        "case": {
            "type": "link",
            "required": true
        },
        "category": {
            "type": "enum",
            "options": [
                "key_facts",
                "strategy",
                "decisions",
                "contacts_notes",
                "timeline",
                "documents_notes",
                "billing_notes"
            ],
            "default": "key_facts",
            "required": true,
            "style": {
                "key_facts": "primary",
                "strategy": "info",
                "decisions": "warning",
                "contacts_notes": "default",
                "timeline": "success",
                "documents_notes": "default",
                "billing_notes": "default"
            }
        },
        "content": {
            "type": "text",
            "required": true
        },
        "source": {
            "type": "enum",
            "options": ["manual", "assistant", "auto"],
            "default": "manual",
            "readOnly": true
        },
        "importance": {
            "type": "enum",
            "options": ["low", "normal", "high", "critical"],
            "default": "normal",
            "style": {
                "low": "default",
                "normal": "primary",
                "high": "warning",
                "critical": "danger"
            }
        },
        "isPinned": {
            "type": "bool",
            "default": false
        },
        "isArchived": {
            "type": "bool",
            "default": false
        },
        "sourceEntityType": {
            "type": "varchar",
            "maxLength": 100,
            "readOnly": true
        },
        "sourceEntityId": {
            "type": "varchar",
            "maxLength": 36,
            "readOnly": true
        },
        "assignedUser": {
            "type": "link",
            "view": "views/fields/assigned-user"
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams"
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true
        }
    },
    "links": {
        "case": {
            "type": "belongsTo",
            "entity": "Case",
            "foreign": "caseMemories"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc",
        "textFilterFields": ["name", "content"]
    },
    "indexes": {
        "caseId": {
            "columns": ["caseId", "deleted"]
        },
        "caseCategory": {
            "columns": ["caseId", "category", "deleted"]
        },
        "casePinned": {
            "columns": ["caseId", "isPinned", "deleted"]
        },
        "importance": {
            "columns": ["importance", "deleted"]
        }
    }
}
