{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/serp-agent-com/json-schema/serp-agent-com-project-detail-schema.json",
  "title": "ProjectDetail",
  "description": "Project (with counts) plus latest_audit.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/serp-agent-com-openapi.json#/components/schemas/ProjectDetail",
  "type": "object",
  "required": [
    "project_id",
    "url",
    "name",
    "status",
    "language",
    "country",
    "sandbox",
    "access",
    "created_at",
    "counts",
    "latest_audit"
  ],
  "properties": {
    "project_id": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "name": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "setup",
        "running",
        "completed",
        "paused"
      ]
    },
    "language": {
      "type": "string"
    },
    "country": {
      "type": "string"
    },
    "sandbox": {
      "type": "boolean"
    },
    "access": {
      "type": "string",
      "enum": [
        "active",
        "pending_payment",
        "sandbox"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "counts": {
      "type": "object",
      "properties": {
        "keywords": {
          "type": "integer"
        },
        "articles": {
          "type": "integer"
        },
        "audits": {
          "type": "integer"
        }
      }
    },
    "latest_audit": {
      "$ref": "#/$defs/LatestAudit"
    }
  },
  "$defs": {
    "AuditSummary": {
      "type": "object",
      "description": "Summarized audit report — severity counts, top issues (grouped per check, capped at 10, worst first), and per-category scores.",
      "required": [
        "issues_critical",
        "issues_warning",
        "issues_info",
        "top_issues",
        "categories"
      ],
      "properties": {
        "issues_critical": {
          "type": "integer"
        },
        "issues_warning": {
          "type": "integer"
        },
        "issues_info": {
          "type": "integer"
        },
        "top_issues": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "check",
              "severity",
              "title",
              "affected_count"
            ],
            "properties": {
              "check": {
                "type": "string",
                "description": "Check type, e.g. SSL, PAGESPEED, SITEMAP, CANONICAL, MOBILE."
              },
              "severity": {
                "type": "string",
                "enum": [
                  "critical",
                  "warning",
                  "info"
                ]
              },
              "title": {
                "type": "string"
              },
              "affected_count": {
                "type": "integer"
              }
            }
          }
        },
        "categories": {
          "type": "object",
          "description": "Average score 0–100 per category (performance, security, indexability, mobile, structure, other). Only categories with scored checks appear.",
          "additionalProperties": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    },
    "LatestAudit": {
      "type": [
        "object",
        "null"
      ],
      "description": "Latest COMPLETED technical audit, or null when none has completed.",
      "properties": {
        "audit_id": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "running",
            "completed",
            "failed"
          ]
        },
        "completed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "score": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Overall score 0–100."
        },
        "summary": {
          "oneOf": [
            {
              "$ref": "#/$defs/AuditSummary"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}