{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://toolbelt.utlyze.com/data/agent-catalog.schema.json",
  "title": "Toolbelt public agent catalog",
  "type": "object",
  "required": ["schema_version", "updated_at", "catalog_url", "selection_note", "counts", "records"],
  "properties": {
    "$schema": {"type": "string", "format": "uri"},
    "schema_version": {"const": "1.0"},
    "name": {"type": "string"},
    "updated_at": {"type": "string", "format": "date-time"},
    "catalog_url": {"type": "string", "format": "uri"},
    "selection_note": {"type": "string"},
    "counts": {"type": "object", "required": ["api_references", "dataset_providers", "dataset_families", "records"], "additionalProperties": {"type": "integer", "minimum": 0}},
    "records": {"type": "array", "items": {"$ref": "#/$defs/record"}}
  },
  "additionalProperties": false,
  "$defs": {
    "geography": {
      "type": "object",
      "description": "Evidence-based declared geographic scope, not tested row coverage. Missing or empty detail remains unconfirmed. National/global coverage can include subdivisions; local areas never imply complete state or country coverage. Countries and subdivisions constrain the declared scope when present. Query place names are not inferred; use the geography search argument.",
      "required": ["scope"],
      "properties": {
        "scope": {"enum": ["global", "national", "regional", "local", "unknown"]},
        "countries": {"type": "array", "items": {"type": "string", "pattern": "^[A-Z]{2}$"}, "description": "Covered ISO 3166-1 alpha-2 countries. Empty is unknown unless scope explicitly declares global coverage."},
        "subdivisions": {"type": "array", "items": {"type": "string", "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"}, "description": "Covered ISO 3166-2 subdivisions. A local area's parent subdivision identifies its location, not statewide coverage."},
        "areas": {"type": "array", "items": {"type": "string"}, "description": "Named covered areas interpreted with country/subdivision context; bare names do not establish identity."},
        "summary": {"type": "string"},
        "source_urls": {"type": "array", "items": {"type": "string", "format": "uri"}, "description": "Public source evidence for this coverage; never account or query receipts."}
      },
      "additionalProperties": false
    },
    "record": {
      "type": "object",
      "required": ["id", "kind", "name", "summary", "use_cases", "industries", "topics", "access", "links", "source_urls"],
      "properties": {
        "id": {"type": "string", "minLength": 1},
        "kind": {"enum": ["api", "dataset"]},
        "name": {"type": "string", "minLength": 1},
        "provider_id": {"type": "string"},
        "provider_name": {"type": "string"},
        "summary": {"type": "string"},
        "use_cases": {"type": "array", "items": {"type": "string"}},
        "industries": {"type": "array", "items": {"type": "string"}},
        "topics": {"type": "array", "items": {"type": "string"}},
        "geography": {"$ref": "#/$defs/geography"},
        "aliases": {"type": "array", "items": {"type": "string"}, "description": "Public alternative names or research terms for this exact resource."},
        "field_names": {"type": "array", "items": {"type": "string"}, "description": "Published field names, not proof that every requested field or row is available."},
        "coverage_notes": {"type": "array", "items": {"type": "string"}, "description": "Coverage limits and qualification guidance for this exact resource."},
        "time_coverage": {"type": "string", "description": "Published period or update scope; empty is unconfirmed."},
        "access": {"type": "object", "required": ["mode", "label", "summary"], "properties": {"mode": {"enum": ["no_key", "free_key", "registration", "paid", "restricted", "varies", "unknown"]}, "label": {"type": "string"}, "summary": {"type": "string"}}, "additionalProperties": true},
        "links": {"type": "object", "required": ["toolbelt", "documentation"], "additionalProperties": {"type": "string", "format": "uri"}},
        "source_urls": {"type": "array", "items": {"type": "string", "format": "uri"}},
        "coverage": {"type": "object"},
        "reference_check": {"type": "object", "required": ["result", "url", "checked_at", "limitation"], "properties": {"result": {"type": "string"}, "url": {"type": "string", "format": "uri"}, "checked_at": {"type": "string"}, "limitation": {"type": "string"}}, "additionalProperties": false}
      },
      "additionalProperties": false
    }
  }
}
