{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/componecat-ai/json-schema/componecat-ai-rest-api-response-of-scorecard-report-item-schema.json",
  "title": "RestApiResponseOfScorecardReportItem",
  "description": "Standard REST API response envelope for a single resource.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/componecat-ai-scorecards-api-openapi.yml#/components/schemas/RestApiResponseOfScorecardReportItem",
  "required": [
    "data"
  ],
  "type": "object",
  "properties": {
    "data": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/ScorecardReportItem"
        }
      ]
    }
  },
  "$defs": {
    "ScoreDistributionBucketItem": {
      "required": [
        "label",
        "minScore",
        "maxScore",
        "count"
      ],
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "minScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "maxScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "count": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        }
      },
      "description": "A fixed score range and how many in-scope entities fall in it."
    },
    "ScorecardKindBreakdownItem": {
      "required": [
        "kindId",
        "kindKey",
        "entityCount",
        "meanScore",
        "percentFullyPassing",
        "failingEntityCount",
        "drillDownQuery"
      ],
      "type": "object",
      "properties": {
        "kindId": {
          "type": "string",
          "format": "uuid"
        },
        "kindKey": {
          "type": "string"
        },
        "entityCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "meanScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "number",
            "string"
          ],
          "format": "double"
        },
        "percentFullyPassing": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "number",
            "string"
          ],
          "format": "double"
        },
        "failingEntityCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "drillDownQuery": {
          "type": "string"
        }
      },
      "description": "One entity kind's standing within a scorecard's scope, worst-first by double ScorecardKindBreakdownItem.PercentFullyPassing."
    },
    "ScorecardLevelBreakdownItem": {
      "required": [
        "level",
        "count",
        "drillDownQuery"
      ],
      "type": "object",
      "properties": {
        "level": {
          "type": [
            "null",
            "string"
          ]
        },
        "count": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "drillDownQuery": {
          "type": "string"
        }
      },
      "description": "How many in-scope entities attained one ladder level (or none, when string? ScorecardLevelBreakdownItem.Level is null)."
    },
    "ScorecardReportItem": {
      "required": [
        "scorecardId",
        "scopeCount",
        "meanScore",
        "percentFullyPassing",
        "scoreDistribution",
        "levelBreakdown",
        "teamBreakdown",
        "kindBreakdown",
        "ruleBreakdown",
        "trend"
      ],
      "type": "object",
      "properties": {
        "scorecardId": {
          "type": "string",
          "format": "uuid"
        },
        "scopeCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "meanScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "null",
            "number",
            "string"
          ],
          "format": "double"
        },
        "percentFullyPassing": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "null",
            "number",
            "string"
          ],
          "format": "double"
        },
        "scoreDistribution": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScoreDistributionBucketItem"
          }
        },
        "levelBreakdown": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardLevelBreakdownItem"
          }
        },
        "teamBreakdown": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardTeamBreakdownItem"
          }
        },
        "kindBreakdown": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardKindBreakdownItem"
          }
        },
        "ruleBreakdown": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardRuleBreakdownItem"
          }
        },
        "trend": {
          "$ref": "#/$defs/ScorecardTrendItem"
        }
      },
      "description": "Rollup aggregates and score trend for one scorecard (ADR-011 decision 8) -- the REST\nequivalent of the scorecard detail page's Report tab: distribution, breakdown by ladder\nlevel, owning team, and kind, per-rule failure counts (highest-first), and the score trend.\nint ScorecardReportItem.ScopeCount zero means the scope currently matches no entities (or has not been\nevaluated yet); every other numeric field is null and every list is empty in that case, same\nas the GraphQL `scorecardReport` query this endpoint delegates to."
    },
    "ScorecardRuleBreakdownItem": {
      "required": [
        "ruleId",
        "ruleName",
        "ruleType",
        "inScopeCount",
        "failCount",
        "drillDownQuery"
      ],
      "type": "object",
      "properties": {
        "ruleId": {
          "type": "string",
          "format": "uuid"
        },
        "ruleName": {
          "type": "string"
        },
        "ruleType": {
          "type": "string"
        },
        "inScopeCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "failCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "drillDownQuery": {
          "type": [
            "null",
            "string"
          ]
        }
      },
      "description": "How often one rule fails among the scorecard's in-scope entities, highest-failure-count\nfirst. string? ScorecardRuleBreakdownItem.DrillDownQuery is null for a `REQUIRED_FIELDS_COMPLETE` rule, which\nhas no reconstructable catalog query to negate."
    },
    "ScorecardTeamBreakdownItem": {
      "required": [
        "teamId",
        "teamName",
        "entityCount",
        "meanScore",
        "percentFullyPassing",
        "failingEntityCount",
        "drillDownQuery"
      ],
      "type": "object",
      "properties": {
        "teamId": {
          "type": "string",
          "format": "uuid"
        },
        "teamName": {
          "type": "string"
        },
        "entityCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "meanScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "number",
            "string"
          ],
          "format": "double"
        },
        "percentFullyPassing": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "number",
            "string"
          ],
          "format": "double"
        },
        "failingEntityCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "drillDownQuery": {
          "type": "string"
        }
      },
      "description": "One owning team's standing within a scorecard's scope, worst-first by double ScorecardTeamBreakdownItem.PercentFullyPassing."
    },
    "ScorecardTrendItem": {
      "required": [
        "scorecardId",
        "definitionChangedAt",
        "points"
      ],
      "type": "object",
      "properties": {
        "scorecardId": {
          "type": "string",
          "format": "uuid"
        },
        "definitionChangedAt": {
          "type": [
            "null",
            "string"
          ],
          "format": "date-time"
        },
        "points": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardTrendPointItem"
          }
        }
      },
      "description": "The score trend for one scorecard -- one point per calendar day at least one entity's score\nchanged, not a full-fleet daily snapshot (history is change-only, ADR-011 decision 6)."
    },
    "ScorecardTrendPointItem": {
      "required": [
        "date",
        "averageScore",
        "changedEntityCount"
      ],
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "format": "date-time"
        },
        "averageScore": {
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
          "type": [
            "number",
            "string"
          ],
          "format": "double"
        },
        "changedEntityCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        }
      },
      "description": "One day's average of the scores recorded changing that day."
    }
  }
}