{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "method_version",
    "frame_version",
    "day",
    "timezone_offset_minutes",
    "generated_at",
    "period_start",
    "period_end",
    "coverage",
    "clock",
    "metrics",
    "conclusion",
    "snapshot_sha256"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "method_version": {
      "const": 1
    },
    "frame_version": {
      "const": 1
    },
    "day": {
      "type": "string",
      "format": "date"
    },
    "timezone_offset_minutes": {
      "const": -180
    },
    "generated_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "period_start": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "period_end": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "reasons"
      ],
      "properties": {
        "status": {
          "enum": [
            "complete",
            "partial",
            "unavailable"
          ]
        },
        "reasons": {
          "type": "array",
          "uniqueItems": true,
          "maxItems": 8,
          "items": {
            "enum": [
              "coverage_unverified",
              "clock_unverified",
              "logs_unavailable",
              "scan_truncated",
              "invalid_lines",
              "future_lines",
              "history_unavailable",
              "retained_lower_bound"
            ]
          }
        }
      }
    },
    "clock": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "enum": [
            "verified",
            "unverified"
          ]
        }
      }
    },
    "metrics": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "requests",
        "origins",
        "bot_origins",
        "scan_origins",
        "user_agents",
        "changing_origins",
        "errors",
        "limited",
        "paths",
        "writes",
        "accepted_writes",
        "server_errors"
      ],
      "properties": {
        "requests": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "origins": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "bot_origins": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "scan_origins": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "user_agents": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "changing_origins": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "errors": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "limited": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "paths": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "writes": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "accepted_writes": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        },
        "server_errors": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          ]
        }
      }
    },
    "conclusion": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "text"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "text": {
          "enum": [
            "Incomplete observation data.",
            "No external requests recorded.",
            "Activity recorded; AI authorship undetermined.",
            "Self-declared bot activity; AI authorship unverified."
          ]
        }
      }
    },
    "snapshot_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:mdzhb:transmission:snapshot:1",
  "description": "Structure only; CONTRACT.md and model.validate also enforce semantic invariants."
}
