{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://botlandscape.com/entity.schema.json",
  "title": "Bot Landscape entity dossier",
  "type": "object",
  "additionalProperties": false,
  "required": ["$schema", "schema_version", "data_release", "data_audited", "entity", "relations", "claims", "sources"],
  "properties": {
    "$schema": {"const": "https://botlandscape.com/entity.schema.json"},
    "schema_version": {"const": 1},
    "data_release": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "data_audited": {"type": "string", "format": "date"},
    "entity": {"type": "object"},
    "relations": {"type": "array", "items": {"type": "object"}},
    "claims": {"type": "array", "items": {"$ref": "#/$defs/claim"}},
    "sources": {"type": "array", "items": {"type": "object"}}
  },
  "$defs": {
    "subject": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "label"],
      "properties": {
        "id": {"type": "string"},
        "label": {"type": "string"},
        "entity_id": {"type": "string"}
      }
    },
    "value": {
      "type": "object",
      "additionalProperties": false,
      "required": ["state", "text"],
      "properties": {
        "state": {"enum": ["reported", "missing"]},
        "text": {"type": "string"}
      }
    },
    "link": {
      "type": "object",
      "additionalProperties": false,
      "required": ["text", "url"],
      "properties": {
        "text": {"type": "string"},
        "url": {"type": "string", "format": "uri"}
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "url", "page_path", "section_id", "table_id", "class", "row_id", "metric", "subject_ids", "subjects", "value", "evidence", "links"],
      "properties": {
        "id": {"type": "string"},
        "url": {"type": "string", "format": "uri"},
        "page_path": {"type": "string"},
        "section_id": {"type": "string"},
        "table_id": {"type": "string"},
        "class": {"type": "string"},
        "row_id": {"type": "string"},
        "metric": {"type": "string"},
        "subject_ids": {"type": "array", "items": {"type": "string"}},
        "subjects": {"type": "array", "items": {"$ref": "#/$defs/subject"}},
        "value": {"$ref": "#/$defs/value"},
        "evidence": {"type": "array", "items": {"type": "string"}},
        "links": {"type": "array", "items": {"$ref": "#/$defs/link"}}
      }
    }
  }
}
