{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Create a comment on a post or another comment. Comments support nested threading, rich text, embeds, and self-labeling.",
      "errors": [
        {
          "description": "The reply reference is invalid, malformed, or refers to non-existent content",
          "name": "InvalidReply"
        },
        {
          "description": "Comment content exceeds maximum length constraints",
          "name": "ContentTooLong"
        },
        {
          "description": "Comment content is empty or contains only whitespace",
          "name": "ContentEmpty"
        },
        {
          "description": "User is not authorized to create comments on this content",
          "name": "NotAuthorized"
        },
        {
          "description": "Rich text facets are malformed, exceed limits, or reference byte ranges outside the content",
          "name": "InvalidFacets"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "content": {
              "description": "Comment text content",
              "maxGraphemes": 10000,
              "maxLength": 100000,
              "type": "string"
            },
            "embed": {
              "description": "Embedded media or quoted posts",
              "refs": [
                "social.coves.embed.images",
                "social.coves.embed.post"
              ],
              "type": "union"
            },
            "facets": {
              "description": "Annotations for rich text (mentions, links, formatting, block structure)",
              "items": {
                "ref": "social.coves.richtext.facet",
                "type": "ref"
              },
              "maxLength": 200,
              "type": "array"
            },
            "labels": {
              "description": "Self-applied content labels",
              "ref": "com.atproto.label.defs#selfLabels",
              "type": "ref"
            },
            "langs": {
              "description": "Languages used in the comment content (ISO 639-1)",
              "items": {
                "format": "language",
                "type": "string"
              },
              "maxLength": 3,
              "type": "array"
            },
            "reply": {
              "description": "References for maintaining thread structure. Root always points to the original post, parent points to the immediate parent (post or comment).",
              "properties": {
                "parent": {
                  "description": "Strong reference to the immediate parent (post or comment) being replied to",
                  "ref": "com.atproto.repo.strongRef",
                  "type": "ref"
                },
                "root": {
                  "description": "Strong reference to the original post that started the thread",
                  "ref": "com.atproto.repo.strongRef",
                  "type": "ref"
                }
              },
              "required": [
                "root",
                "parent"
              ],
              "type": "object"
            }
          },
          "required": [
            "reply",
            "content"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "description": "CID of the created comment record",
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "description": "AT-URI of the created comment",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.coves.community.comment.create",
  "lexicon": 1
}
