{
  "lexicon": 1,
  "id": "ai.syui.log.chat",
  "defs": {
    "main": {
      "type": "record",
      "description": "Record containing a chat message. Compatible with site.standard.document.",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["site", "title", "publishedAt"],
        "properties": {
          "site": {
            "type": "string",
            "format": "uri",
            "description": "Points to a publication record (at://) or a publication URL (https://)."
          },
          "title": {
            "type": "string",
            "maxLength": 5000,
            "maxGraphemes": 500,
            "description": "Title of the message or thread topic."
          },
          "publishedAt": {
            "type": "string",
            "format": "datetime",
            "description": "Timestamp of the message's publish time."
          },
          "content": {
            "type": "union",
            "closed": false,
            "refs": ["#markdown"],
            "description": "Open union for content. Supports markdown and other formats via $type."
          },
          "description": {
            "type": "string",
            "maxLength": 30000,
            "maxGraphemes": 3000,
            "description": "A brief description or excerpt from the message."
          },
          "textContent": {
            "type": "string",
            "description": "Plaintext representation of the message content. Should not contain markdown or other formatting."
          },
          "updatedAt": {
            "type": "string",
            "format": "datetime",
            "description": "Timestamp of the message's last edit."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 1280,
              "maxGraphemes": 128
            },
            "description": "Tags to categorize the message."
          },
          "path": {
            "type": "string",
            "description": "Combine with site URL to construct a canonical URL to the message."
          },
          "coverImage": {
            "type": "blob",
            "accept": ["image/*"],
            "maxSize": 1000000,
            "description": "Cover image. Less than 1MB."
          },
          "bskyPostRef": {
            "type": "ref",
            "ref": "com.atproto.repo.strongRef",
            "description": "Strong reference to a Bluesky post."
          },
          "root": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the root message in a thread."
          },
          "parent": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the parent message being replied to."
          },
          "langs": {
            "type": "array",
            "maxLength": 3,
            "items": {
              "type": "string",
              "format": "language"
            },
            "description": "Indicates human language of message content."
          },
          "translations": {
            "type": "ref",
            "ref": "#translationMap",
            "description": "Translations of the message in other languages."
          }
        }
      }
    },
    "markdown": {
      "type": "object",
      "description": "Markdown content format.",
      "required": ["text"],
      "properties": {
        "text": {
          "type": "string",
          "maxLength": 1000000,
          "maxGraphemes": 100000,
          "description": "Markdown text content."
        }
      }
    },
    "translationMap": {
      "type": "object",
      "description": "Map of language codes to translations.",
      "properties": {
        "en": { "type": "ref", "ref": "#translation" },
        "ja": { "type": "ref", "ref": "#translation" }
      }
    },
    "translation": {
      "type": "object",
      "description": "A translation of a chat message.",
      "properties": {
        "title": {
          "type": "string",
          "maxLength": 5000,
          "maxGraphemes": 500
        },
        "content": {
          "type": "string",
          "maxLength": 1000000,
          "maxGraphemes": 100000
        }
      }
    }
  }
}
