{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "const": "2.1"
    },
    "id": {
      "type": "string",
      "pattern": "^[0-9]{8}T[0-9]{6}Z$"
    },
    "kind": {
      "const": "assessment"
    },
    "previous_id": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[0-9]{8}T[0-9]{6}Z$"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_start": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "as_of": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "valid_until": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "completion": {
      "enum": [
        "ready",
        "incomplete"
      ]
    },
    "status": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "answer": {
          "enum": [
            "yes",
            "no"
          ]
        },
        "headline": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "rationale": {
          "$ref": "#/$defs/claim"
        },
        "scope": {
          "type": "string",
          "minLength": 1,
          "maxLength": 400
        },
        "confidence": {
          "enum": [
            "low",
            "moderate",
            "high"
          ]
        }
      },
      "required": [
        "answer",
        "headline",
        "rationale",
        "scope",
        "confidence"
      ]
    },
    "operator": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "model": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ]
        },
        "generated_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "prompt_version": {
          "const": "nixie-2.1"
        },
        "workflow": {
          "const": "single_session"
        },
        "note": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        }
      },
      "required": [
        "name",
        "model",
        "generated_at",
        "prompt_version",
        "workflow",
        "note"
      ]
    },
    "topics": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/topic"
      },
      "minItems": 4,
      "maxItems": 4
    },
    "checks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/check"
      },
      "minItems": 2,
      "maxItems": 2
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source"
      },
      "minItems": 0,
      "maxItems": 40
    },
    "self_check": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "result": {
          "enum": [
            "pass",
            "blocked"
          ]
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400
          },
          "minItems": 1,
          "maxItems": 10
        }
      },
      "required": [
        "result",
        "notes"
      ]
    },
    "trending": {
      "$ref": "#/$defs/trending"
    }
  },
  "required": [
    "schema_version",
    "id",
    "kind",
    "previous_id",
    "window_start",
    "as_of",
    "valid_until",
    "completion",
    "status",
    "operator",
    "topics",
    "checks",
    "sources",
    "self_check",
    "trending"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ishumanitysafe.com/schema/update.schema.json",
  "title": "AI assessment v2.1: trending signal and safe generated artwork",
  "$defs": {
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1,
          "maxLength": 650
        },
        "basis": {
          "enum": [
            "observation",
            "inference",
            "unknown",
            "site_note"
          ]
        },
        "source_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "minItems": 0,
          "maxItems": 8,
          "uniqueItems": true
        }
      },
      "required": [
        "text",
        "basis",
        "source_ids"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "basis": {
                "enum": [
                  "observation",
                  "inference"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "source_ids": {
                "minItems": 1
              }
            }
          }
        }
      ]
    },
    "topic": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "enum": [
            "ai",
            "nuclear",
            "resources",
            "pathogens"
          ]
        },
        "answer": {
          "enum": [
            "yes",
            "no"
          ]
        },
        "pressure": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            },
            {
              "type": "null"
            }
          ]
        },
        "judgement": {
          "$ref": "#/$defs/claim"
        },
        "headline": {
          "allOf": [
            {
              "$ref": "#/$defs/claim"
            },
            {
              "properties": {
                "text": {
                  "maxLength": 160
                }
              }
            }
          ]
        },
        "limitations": {
          "$ref": "#/$defs/claim"
        },
        "horizon": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "coverage": {
          "enum": [
            "retrieved",
            "limited",
            "unavailable"
          ]
        },
        "checked_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "snippets": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/claim"
              },
              {
                "properties": {
                  "text": {
                    "maxLength": 220
                  }
                }
              }
            ]
          },
          "minItems": 1,
          "maxItems": 3
        },
        "what_would_change": {
          "type": "string",
          "minLength": 1,
          "maxLength": 400
        }
      },
      "required": [
        "id",
        "answer",
        "pressure",
        "judgement",
        "headline",
        "limitations",
        "horizon",
        "coverage",
        "checked_at",
        "valid_until",
        "snippets",
        "what_would_change"
      ]
    },
    "check": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "enum": [
            "asteroids",
            "space-weather"
          ]
        },
        "status": {
          "enum": [
            "observed",
            "unavailable"
          ]
        },
        "checked_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "scope": {
          "type": "string",
          "minLength": 1,
          "maxLength": 350
        },
        "finding": {
          "$ref": "#/$defs/claim"
        },
        "limitations": {
          "$ref": "#/$defs/claim"
        }
      },
      "required": [
        "id",
        "status",
        "checked_at",
        "valid_until",
        "scope",
        "finding",
        "limitations"
      ]
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{0,63}$"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240
        },
        "publisher": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "type": {
          "enum": [
            "primary",
            "secondary",
            "dataset"
          ]
        },
        "published_on": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ]
        },
        "retrieved_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
        },
        "locator": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        }
      },
      "required": [
        "id",
        "title",
        "publisher",
        "url",
        "type",
        "published_on",
        "retrieved_at",
        "locator"
      ]
    },
    "trendingArt": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "regular"
            },
            "asset": {
              "enum": [
                "ai",
                "nuclear",
                "resources",
                "pathogens"
              ]
            },
            "alt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 220
            }
          },
          "required": [
            "kind",
            "asset",
            "alt"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "custom"
            },
            "svg": {
              "type": "string",
              "minLength": 1,
              "maxLength": 24000
            },
            "alt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 220
            }
          },
          "required": [
            "kind",
            "svg",
            "alt"
          ]
        }
      ],
      "description": "Custom SVG uses the passive subset and fixed motion classes in docs/ARTWORK.md. No scripts, CSS, links, IDs, external resources or SMIL."
    },
    "trending": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "state": {
              "const": "selected"
            },
            "title": {
              "type": "string",
              "minLength": 1,
              "maxLength": 72
            },
            "topic_id": {
              "enum": [
                "ai",
                "nuclear",
                "resources",
                "pathogens",
                "other"
              ]
            },
            "answer": {
              "enum": [
                "yes",
                "no"
              ]
            },
            "pressure": {
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            },
            "summary": {
              "allOf": [
                {
                  "$ref": "#/$defs/claim"
                },
                {
                  "properties": {
                    "text": {
                      "maxLength": 220
                    }
                  }
                }
              ]
            },
            "why_now": {
              "allOf": [
                {
                  "$ref": "#/$defs/claim"
                },
                {
                  "properties": {
                    "text": {
                      "maxLength": 400
                    }
                  }
                }
              ]
            },
            "selection_reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 400
            },
            "limitations": {
              "allOf": [
                {
                  "$ref": "#/$defs/claim"
                },
                {
                  "properties": {
                    "text": {
                      "maxLength": 400
                    }
                  }
                }
              ]
            },
            "horizon": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            },
            "event_date": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ]
            },
            "checked_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
            },
            "valid_until": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
            },
            "art": {
              "$ref": "#/$defs/trendingArt"
            }
          },
          "required": [
            "state",
            "title",
            "topic_id",
            "answer",
            "pressure",
            "summary",
            "why_now",
            "selection_reason",
            "limitations",
            "horizon",
            "event_date",
            "checked_at",
            "valid_until",
            "art"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "state": {
              "const": "none"
            },
            "reason": {
              "allOf": [
                {
                  "$ref": "#/$defs/claim"
                },
                {
                  "properties": {
                    "text": {
                      "maxLength": 300
                    }
                  }
                }
              ]
            },
            "checked_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
            },
            "valid_until": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
            }
          },
          "required": [
            "state",
            "reason",
            "checked_at",
            "valid_until"
          ]
        }
      ],
      "description": "An evidence-led editorial spotlight, not a social-media popularity measurement. Prefer a credible outside-the-regulars signal; never invent one to fill the slot."
    }
  }
}
