{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "rich_text",
  "description": "Zengin metin: başlık, paragraf, liste, alıntı, kod, LaTeX, ayraç. Telegram sendRichMessage blokları buna eşlenir. Serileştirilmiş bileşen en çok 32 KiB (bileşen boyut sınırı); blok/parça sınırları buna göre seçildi, uzun içerik birden çok bileşene bölünür.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "version",
    "blocks"
  ],
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "rich_text"
      ]
    },
    "version": {
      "type": "integer",
      "enum": [
        1
      ]
    },
    "tone": {
      "type": "string",
      "enum": [
        "neutral",
        "success",
        "warning",
        "danger",
        "brand"
      ]
    },
    "brand_color": {
      "type": "string",
      "enum": [
        "mavi",
        "turuncu",
        "mor",
        "pembe",
        "altin",
        "yesil",
        "turkuaz"
      ]
    },
    "title": {
      "type": "string",
      "maxLength": 120
    },
    "blocks": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "heading",
              "paragraph",
              "list",
              "quote",
              "code",
              "math",
              "divider",
              "footer"
            ]
          },
          "text": {
            "type": "string",
            "maxLength": 4096,
            "description": "heading/quote/code/math/footer düz metni (math: LaTeX kaynağı)"
          },
          "runs": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "text": {
                  "type": "string",
                  "maxLength": 1000,
                  "minLength": 1
                },
                "marks": {
                  "type": "array",
                  "minItems": 0,
                  "maxItems": 9,
                  "items": {
                    "type": "string",
                    "enum": [
                      "bold",
                      "italic",
                      "underline",
                      "strikethrough",
                      "spoiler",
                      "code",
                      "highlight",
                      "subscript",
                      "superscript"
                    ]
                  }
                },
                "url": {
                  "type": "string",
                  "pattern": "^https://[^\\s\\x00-\\x1f\\x7f]{1,2040}$"
                },
                "footnote": {
                  "type": "string",
                  "maxLength": 500,
                  "description": "dipnot metni (Telegram RichTextReference eşlemesi)"
                }
              },
              "required": [
                "text"
              ],
              "description": "satır içi parça; `marks` Telegram MessageEntity/RichText biçimlerinin kümesidir"
            },
            "description": "paragraph/quote/footer için satır içi parçalar; verilirse `text`'e üstündür"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "runs": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 50,
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "text": {
                        "type": "string",
                        "maxLength": 1000,
                        "minLength": 1
                      },
                      "marks": {
                        "type": "array",
                        "minItems": 0,
                        "maxItems": 9,
                        "items": {
                          "type": "string",
                          "enum": [
                            "bold",
                            "italic",
                            "underline",
                            "strikethrough",
                            "spoiler",
                            "code",
                            "highlight",
                            "subscript",
                            "superscript"
                          ]
                        }
                      },
                      "url": {
                        "type": "string",
                        "pattern": "^https://[^\\s\\x00-\\x1f\\x7f]{1,2040}$"
                      },
                      "footnote": {
                        "type": "string",
                        "maxLength": 500,
                        "description": "dipnot metni (Telegram RichTextReference eşlemesi)"
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "description": "satır içi parça; `marks` Telegram MessageEntity/RichText biçimlerinin kümesidir"
                  }
                }
              },
              "required": [
                "runs"
              ]
            }
          },
          "ordered": {
            "type": "boolean"
          },
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3,
            "description": "heading düzeyi"
          },
          "language": {
            "type": "string",
            "maxLength": 32,
            "description": "code bloğu dili"
          },
          "anchor": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "description": "bağlantı çapası (RichBlockAnchor)"
          }
        },
        "required": [
          "kind"
        ]
      }
    }
  }
}
