{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commareports-com/json-schema/commareports-com-comments-page-schema.json",
  "title": "CommentsPage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commareports-com-comments-api-openapi.yml#/components/schemas/CommentsPage",
  "type": "object",
  "properties": {
    "comments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Comment"
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass as ?cursor= to fetch the next page; null when exhausted."
    }
  },
  "required": [
    "comments",
    "nextCursor"
  ],
  "$defs": {
    "Anchor": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string"
        },
        "prefix": {
          "type": [
            "string",
            "null"
          ]
        },
        "suffix": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "text"
      ]
    },
    "Comment": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "body": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "resolved"
          ]
        },
        "author": {
          "$ref": "#/$defs/CommentAuthor"
        },
        "author_type": {
          "type": "string",
          "enum": [
            "user",
            "agent",
            "system"
          ]
        },
        "block_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "anchor": {
          "oneOf": [
            {
              "$ref": "#/$defs/Anchor"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "replies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Reply"
          }
        },
        "replies_truncated": {
          "type": "boolean",
          "description": "True when the thread has more than the 50 embedded replies."
        }
      },
      "required": [
        "id",
        "body",
        "status",
        "author",
        "created_at",
        "updated_at",
        "replies"
      ]
    },
    "CommentAuthor": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "null for agent / system (auto-changelog) comments."
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id"
      ]
    },
    "Reply": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "body": {
          "type": "string"
        },
        "author": {
          "$ref": "#/$defs/CommentAuthor"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "body",
        "author",
        "created_at",
        "updated_at"
      ]
    }
  }
}