{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/componecat-ai/json-schema/componecat-ai-rest-api-response-of-entity-scorecard-result-item-schema.json",
  "title": "RestApiResponseOfEntityScorecardResultItem",
  "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/RestApiResponseOfEntityScorecardResultItem",
  "required": [
    "data"
  ],
  "type": "object",
  "properties": {
    "data": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "$ref": "#/$defs/EntityScorecardResultItem"
      }
    }
  },
  "$defs": {
    "EntityScorecardResultItem": {
      "required": [
        "scorecardId",
        "scorecardName",
        "scorecardDisplayName",
        "scorecardDescription",
        "levels",
        "evaluation"
      ],
      "type": "object",
      "properties": {
        "scorecardId": {
          "type": "string",
          "format": "uuid"
        },
        "scorecardName": {
          "type": "string"
        },
        "scorecardDisplayName": {
          "type": "string"
        },
        "scorecardDescription": {
          "type": [
            "null",
            "string"
          ]
        },
        "levels": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "evaluation": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ScorecardEvaluationItem"
            }
          ]
        }
      },
      "description": "One scorecard applicable to a catalog entity, paired with its current evaluation when one\nexists (ADR-011 decision 8). Mirrors the GraphQL `entityScorecards` shape."
    },
    "ScorecardEvaluationItem": {
      "required": [
        "id",
        "score",
        "attainedLevel",
        "passedRuleCount",
        "totalRuleCount",
        "evaluatedAt",
        "ruleResults"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "score": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "attainedLevel": {
          "type": [
            "null",
            "string"
          ]
        },
        "passedRuleCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "totalRuleCount": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "evaluatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "ruleResults": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScorecardRuleResultItem"
          }
        }
      },
      "description": "The current evaluation result for one (scorecard, entity) pair. Null on the parent\nScorecardEvaluationItem? EntityScorecardResultItem.Evaluation means the entity is in scope but has not\nbeen picked up by an evaluation pass yet — distinct from a real, unfavourable zero score."
    },
    "ScorecardRuleResultItem": {
      "required": [
        "ruleId",
        "ruleName",
        "passed",
        "detail",
        "failureMessage",
        "remediationUrl"
      ],
      "type": "object",
      "properties": {
        "ruleId": {
          "type": "string",
          "format": "uuid"
        },
        "ruleName": {
          "type": [
            "null",
            "string"
          ]
        },
        "passed": {
          "type": "boolean"
        },
        "detail": {
          "type": [
            "null",
            "string"
          ]
        },
        "failureMessage": {
          "type": [
            "null",
            "string"
          ]
        },
        "remediationUrl": {
          "type": [
            "null",
            "string"
          ]
        }
      },
      "description": "The pass/fail outcome of a single rule within one evaluation, with the rule's own\nfailure message and remediation link folded in so a client never has to join back to\nthe scorecard definition to render a failing result."
    }
  }
}