{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/webanalyzer-dev/json-schema/webanalyzer-dev-analysis-job-schema.json",
  "title": "AnalysisJob",
  "description": "State of an asynchronous analysis job.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/webanalyzer-dev-openapi.json#/components/schemas/AnalysisJob",
  "type": "object",
  "required": [
    "id",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Opaque job id."
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "complete",
        "failed"
      ],
      "description": "Job state."
    },
    "statusUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL to poll for this job."
    },
    "estimatedSeconds": {
      "type": "integer",
      "description": "Rough seconds until completion while running."
    },
    "result": {
      "$ref": "#/$defs/AnalysisSummary"
    },
    "error": {
      "type": "object",
      "description": "Present when status is failed.",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "AnalysisSummary": {
      "type": "object",
      "description": "The result of analyzing one URL.",
      "required": [
        "id",
        "url",
        "score",
        "grade",
        "dimensions"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Analysis id — also the key for the badge and report URLs."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Final URL after redirects."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Page title."
        },
        "score": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "Overall 0-100 score (demanding curve)."
        },
        "grade": {
          "type": "string",
          "description": "Letter grade, A+ through F."
        },
        "dimensions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DimensionScore"
          }
        },
        "topIssues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Issue"
          }
        },
        "badgeUrl": {
          "type": "string",
          "format": "uri",
          "description": "Embeddable SVG score badge."
        },
        "reportUrl": {
          "type": "string",
          "format": "uri",
          "description": "Human-readable report page."
        },
        "scoringNote": {
          "type": "string"
        }
      }
    },
    "DimensionScore": {
      "type": "object",
      "description": "Score for one of the 8 quality dimensions.",
      "required": [
        "key",
        "label",
        "score",
        "grade"
      ],
      "properties": {
        "key": {
          "type": "string",
          "description": "Stable dimension identifier.",
          "enum": [
            "seo",
            "geo",
            "performance",
            "accessibility",
            "codeQuality",
            "uiux",
            "dataTracking",
            "security"
          ]
        },
        "label": {
          "type": "string",
          "description": "Human-readable dimension name."
        },
        "score": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "Dimension score, 0-100."
        },
        "grade": {
          "type": "string",
          "description": "Letter grade, A+ through F."
        },
        "summary": {
          "type": "string",
          "description": "One-sentence summary of the dimension result."
        }
      }
    },
    "Issue": {
      "type": "object",
      "description": "One of the most important problems found on the page.",
      "required": [
        "dimension",
        "title"
      ],
      "properties": {
        "dimension": {
          "type": "string",
          "description": "Dimension the issue belongs to."
        },
        "title": {
          "type": "string",
          "description": "What is wrong, in one sentence."
        },
        "detail": {
          "type": "string",
          "description": "Specifics of the finding on this page."
        }
      }
    }
  }
}