{
    "title": "chat_messages",
    "type": "object",
    "properties": {
        "id": {
            "type": "integer",
            "description": "Primary key, auto-increment"
        },
        "conversation_id": {
            "type": "integer",
            "description": "FK to chat_conversations.id"
        },
        "sender_type": {
            "type": "string",
            "description": "visitor|ai|agent|system"
        },
        "sender_seat_id": {
            "type": "integer",
            "description": "FK to support_seats.id when agent"
        },
        "sender_name": {
            "type": "string",
            "description": "Display name of sender"
        },
        "content": {
            "type": "string",
            "description": "Message body (text)"
        },
        "attachments": {
            "type": "string",
            "description": "JSON array of attachment metadata"
        },
        "is_internal_note": {
            "type": "boolean",
            "description": "True when visible only to agents"
        },
        "ai_confidence": {
            "type": "number",
            "description": "AI reply confidence 0-1"
        }
    },
    "required": [
        "id",
        "conversation_id",
        "sender_type",
        "content"
    ]
}