{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cubic-dev/json-schema/cubic-dev-analytics-pr-page-schema.json",
  "title": "AnalyticsPrPage",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cubic-dev-analytics-openapi.yml#/components/schemas/AnalyticsPrPage",
  "type": "object",
  "required": [
    "data",
    "nextCursor"
  ],
  "properties": {
    "data": {
      "type": "array",
      "description": "Merged pull requests with at least one completed cubic review in the selected date window, ordered by merge time, newest first.",
      "items": {
        "$ref": "#/$defs/AnalyticsPrRow"
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cursor for the next page, or null on the last page."
    }
  },
  "$defs": {
    "AnalyticsPrRow": {
      "type": "object",
      "required": [
        "org",
        "repo",
        "prNumber",
        "author",
        "createdAt",
        "mergedAt",
        "linesAdded",
        "linesDeleted",
        "numberOfCubicIssuesFlagged",
        "numberOfCubicIssuesFixed",
        "cubicFirstReviewedAt",
        "totalAiLinesAuthored"
      ],
      "properties": {
        "org": {
          "type": "string",
          "description": "GitHub owner used for the request."
        },
        "repo": {
          "type": "string",
          "description": "Repository name."
        },
        "prNumber": {
          "type": "integer",
          "description": "Pull request number."
        },
        "author": {
          "type": "string",
          "description": "GitHub login of the pull request author."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "Pull request creation timestamp in ISO 8601 format."
        },
        "mergedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Pull request merge timestamp in ISO 8601 format."
        },
        "linesAdded": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Lines added in the pull request, or `null` when unavailable."
        },
        "linesDeleted": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Lines deleted in the pull request, or `null` when unavailable."
        },
        "numberOfCubicIssuesFlagged": {
          "type": "integer",
          "description": "Posted cubic findings on the merged pull request, created within the requested date range."
        },
        "numberOfCubicIssuesFixed": {
          "type": "integer",
          "description": "Posted findings in the requested date range with a detected code change (`aiAddressed = true`). Positive feedback alone does not count as a fix, and downvotes do not erase detected fixes."
        },
        "cubicFirstReviewedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp of the first completed cubic review for the pull request."
        },
        "totalAiLinesAuthored": {
          "type": [
            "integer",
            "null"
          ],
          "description": "AI-authored lines attributed to the pull request, capped at its total added and deleted lines; null when no AI authorship data is available."
        }
      }
    }
  }
}