{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aiagentatlas.net/catalog.schema.json",
  "title": "Agent Atlas Catalog",
  "type": "object",
  "required": ["catalog_name", "catalog_version", "generated_at", "review_tiers", "review_queue", "entries"],
  "properties": {
    "catalog_name": { "type": "string" },
    "catalog_version": { "type": "string" },
    "generated_at": { "type": "string", "format": "date-time" },
    "disclaimer": { "type": "string" },
    "review_tiers": {
      "type": "object",
      "required": ["reviewed", "candidate", "caution"],
      "properties": {
        "reviewed": { "type": "string" },
        "candidate": { "type": "string" },
        "caution": { "type": "string" }
      }
    },
    "privacy": { "type": "object" },
    "review_queue": {
      "type": "object",
      "required": ["pending_candidates", "last_exhausted_at", "policy"],
      "properties": {
        "pending_candidates": { "type": "integer", "minimum": 0 },
        "last_exhausted_at": { "type": "string", "format": "date-time" },
        "policy": { "type": "string" }
      }
    },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "description", "content_type", "review_tier", "categories", "project_status", "source_url", "verification"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "content_type": { "type": "string" },
          "review_tier": { "enum": ["reviewed", "candidate", "caution"] },
          "categories": { "type": "array", "items": { "type": "string" } },
          "project_status": { "enum": ["official", "community", "unverified", "archived"] },
          "source_url": { "type": "string", "format": "uri" },
          "homepage_url": { "type": ["string", "null"], "format": "uri" },
          "author": { "type": "object" },
          "license": { "type": ["string", "null"] },
          "languages": { "type": "array", "items": { "type": "string" } },
          "interfaces": { "type": "array", "items": { "type": "string" } },
          "relationships": {
            "type": "object",
            "properties": {
              "similar_to": { "$ref": "#/$defs/relationshipIds" },
              "alternative_to": { "$ref": "#/$defs/relationshipIds" },
              "fork_of": { "$ref": "#/$defs/relationshipIds" },
              "supersedes": { "$ref": "#/$defs/relationshipIds" }
            },
            "additionalProperties": false
          },
          "verification": {
            "type": "object",
            "required": ["level", "reviewed_at", "checks", "notes"],
            "properties": {
              "level": { "type": "string" },
              "reviewed_at": { "type": "string", "format": "date" },
              "checks": { "type": "array", "items": { "type": "string" } },
              "notes": { "type": "string" }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "relationshipIds": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" }
    }
  }
}
