{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://nerabotaetv.ru/contracts/api-v2/contract.schema.json",
  "title": "NE RABOTAET V RF API v2 draft.2 shared definitions",
  "description": "Public API v2 pilot shared definitions. Runtime and cross-field requirements: semantics.md and profiles.json.",
  "definitions": {
    "Target": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "query_redacted",
        "target_key",
        "hostname",
        "scheme",
        "port"
      ],
      "properties": {
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "description": "Display URL: query removed. Never execute this representation."
        },
        "query_redacted": {
          "type": "boolean"
        },
        "target_key": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^[0-9a-f]{64}$"
        },
        "hostname": {
          "type": "string",
          "maxLength": 253,
          "minLength": 1
        },
        "scheme": {
          "enum": [
            "http",
            "https"
          ]
        },
        "port": {
          "enum": [
            80,
            443
          ]
        }
      }
    },
    "ExecutionTarget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "target_key",
        "hostname",
        "scheme",
        "port"
      ],
      "properties": {
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "description": "Full canonical URL including exact path/query. Secret-bearing; no logs, only assigned probe."
        },
        "target_key": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^[0-9a-f]{64}$"
        },
        "hostname": {
          "type": "string",
          "maxLength": 253,
          "minLength": 1
        },
        "scheme": {
          "enum": [
            "http",
            "https"
          ]
        },
        "port": {
          "enum": [
            80,
            443
          ]
        }
      }
    },
    "Profile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "revision",
        "method_version",
        "max_units_per_probe",
        "execution_timeout_ms",
        "check_deadline_seconds",
        "comparison_window_seconds",
        "lease_seconds",
        "ack_timeout_seconds",
        "delivery_grace_seconds",
        "max_redirects",
        "max_candidates_per_hop",
        "max_candidates_per_family",
        "max_parallel_connects",
        "connection_attempt_delay_ms",
        "max_connections",
        "max_http_requests",
        "max_dns_questions",
        "max_dns_wire_queries",
        "max_dns_answers_per_question",
        "max_cname_depth",
        "max_response_header_bytes",
        "max_decoded_body_bytes_per_response",
        "max_response_wire_bytes_total",
        "max_dns_wire_bytes_total",
        "max_result_bytes",
        "dns_timeout_ms",
        "connect_timeout_ms",
        "tls_timeout_ms",
        "http_timeout_ms",
        "diagnostic_address_limit",
        "target_policy",
        "dns_policy",
        "request_policy",
        "tls_policy",
        "protocols",
        "description"
      ],
      "properties": {
        "id": {
          "enum": [
            "web-basic-v1",
            "web-url-v1",
            "web-diagnostic-v1"
          ]
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        },
        "method_version": {
          "const": "go-web-2"
        },
        "max_units_per_probe": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        },
        "execution_timeout_ms": {
          "type": "integer",
          "minimum": 1,
          "maximum": 30000
        },
        "check_deadline_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 90
        },
        "comparison_window_seconds": {
          "enum": [
            60,
            90
          ]
        },
        "lease_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "ack_timeout_seconds": {
          "const": 5
        },
        "delivery_grace_seconds": {
          "const": 5
        },
        "max_redirects": {
          "const": 3
        },
        "max_candidates_per_hop": {
          "const": 4
        },
        "max_candidates_per_family": {
          "const": 2
        },
        "max_parallel_connects": {
          "const": 2
        },
        "connection_attempt_delay_ms": {
          "const": 250
        },
        "max_connections": {
          "type": "integer",
          "minimum": 1,
          "maximum": 12
        },
        "max_http_requests": {
          "type": "integer",
          "minimum": 1,
          "maximum": 8
        },
        "max_dns_questions": {
          "type": "integer",
          "minimum": 1,
          "maximum": 12
        },
        "max_dns_wire_queries": {
          "type": "integer",
          "minimum": 1,
          "maximum": 24
        },
        "max_dns_answers_per_question": {
          "const": 32
        },
        "max_cname_depth": {
          "const": 8
        },
        "max_response_header_bytes": {
          "const": 16384
        },
        "max_decoded_body_bytes_per_response": {
          "const": 16384
        },
        "max_response_wire_bytes_total": {
          "type": "integer",
          "minimum": 1,
          "maximum": 262144
        },
        "max_dns_wire_bytes_total": {
          "const": 131072
        },
        "max_result_bytes": {
          "const": 262144
        },
        "dns_timeout_ms": {
          "const": 3000
        },
        "connect_timeout_ms": {
          "const": 3000
        },
        "tls_timeout_ms": {
          "const": 5000
        },
        "http_timeout_ms": {
          "const": 8000
        },
        "diagnostic_address_limit": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4
        },
        "target_policy": {
          "enum": [
            "public-root-http-https-v1",
            "private-url-http-https-v1"
          ]
        },
        "dns_policy": {
          "const": "probe-configured-recursive-v1"
        },
        "request_policy": {
          "const": "get-no-cookies-identity-v1"
        },
        "tls_policy": {
          "const": "verify-system-roots-no-ech-v1"
        },
        "protocols": {
          "type": "array",
          "items": {
            "enum": [
              "http/1.1",
              "h2"
            ]
          },
          "minItems": 2,
          "maxItems": 2,
          "uniqueItems": true
        },
        "description": {
          "type": "string",
          "maxLength": 1000
        }
      }
    },
    "ProfileRef": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "revision"
      ],
      "properties": {
        "id": {
          "enum": [
            "web-basic-v1",
            "web-url-v1",
            "web-diagnostic-v1"
          ]
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "ProfileList": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "profiles"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "profiles": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Profile"
          },
          "minItems": 3,
          "maxItems": 3
        }
      }
    },
    "Locations": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "preset"
          ],
          "properties": {
            "preset": {
              "const": "ru-core"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "probe_ids"
          ],
          "properties": {
            "probe_ids": {
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 128,
                "minLength": 1,
                "pattern": "^[a-zA-Z0-9_-]+$"
              },
              "minItems": 1,
              "maxItems": 10,
              "uniqueItems": true
            }
          }
        }
      ]
    },
    "CheckIntent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "target",
        "locations"
      ],
      "properties": {
        "target": {
          "type": "string",
          "maxLength": 2048,
          "minLength": 1,
          "description": "R-01: DNS name or absolute HTTP(S) URL. web-basic accepts root only; URL/diagnostic preserve exact path/query in private checks. No userinfo/fragments/nonstandard ports."
        },
        "profile": {
          "enum": [
            "web-basic-v1",
            "web-url-v1",
            "web-diagnostic-v1"
          ],
          "default": "web-basic-v1"
        },
        "locations": {
          "$ref": "#/definitions/Locations"
        },
        "freshness_max_age_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 900,
          "default": 300,
          "description": "0 disallows completed cache reuse; it can join still-running work. R-11/R-12."
        }
      }
    },
    "CheckRequest": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "target",
            "locations",
            "max_units"
          ],
          "properties": {
            "target": {
              "type": "string",
              "maxLength": 2048,
              "minLength": 1,
              "description": "R-01: DNS name or absolute HTTP(S) URL. web-basic accepts root only; URL/diagnostic preserve exact path/query in private checks. No userinfo/fragments/nonstandard ports."
            },
            "profile": {
              "enum": [
                "web-basic-v1",
                "web-url-v1",
                "web-diagnostic-v1"
              ],
              "default": "web-basic-v1"
            },
            "locations": {
              "$ref": "#/definitions/Locations"
            },
            "freshness_max_age_seconds": {
              "type": "integer",
              "minimum": 0,
              "maximum": 900,
              "default": 300,
              "description": "0 disallows completed cache reuse; it can join still-running work. R-11/R-12."
            },
            "max_units": {
              "type": "integer",
              "minimum": 0,
              "maximum": 40,
              "description": "Hard cap in quota units, not currency."
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "plan_id",
            "max_units"
          ],
          "properties": {
            "plan_id": {
              "type": "string",
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "max_units": {
              "type": "integer",
              "minimum": 0,
              "maximum": 40
            }
          }
        }
      ]
    },
    "Plan": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "plan_id",
        "expires_at",
        "target",
        "profile",
        "resolved_probe_ids",
        "maximum_units",
        "billing_mode",
        "cache_eligible",
        "freshness_max_age_seconds"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "plan_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "expires_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "target": {
          "$ref": "#/definitions/Target"
        },
        "profile": {
          "$ref": "#/definitions/ProfileRef"
        },
        "resolved_probe_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 1,
          "maxItems": 10,
          "uniqueItems": true
        },
        "maximum_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 40
        },
        "billing_mode": {
          "const": "quota_only"
        },
        "cache_eligible": {
          "type": "boolean"
        },
        "freshness_max_age_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 900
        }
      }
    },
    "Phase": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "duration_ms",
        "code"
      ],
      "properties": {
        "state": {
          "enum": [
            "ok",
            "error",
            "skipped",
            "cancelled",
            "unsupported"
          ]
        },
        "duration_ms": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "code": {
          "anyOf": [
            {
              "enum": [
                "dns.timeout",
                "dns.nxdomain",
                "dns.servfail",
                "dns.refused",
                "dns.invalid_response",
                "dns.transport_error",
                "tcp.timeout",
                "tcp.refused",
                "tcp.reset",
                "tcp.unreachable",
                "tcp.io_error",
                "tls.timeout",
                "tls.reset",
                "tls.handshake_error",
                "tls.cert_expired",
                "tls.cert_not_yet_valid",
                "tls.cert_untrusted",
                "tls.cert_hostname",
                "http.timeout",
                "http.reset",
                "http.read_error",
                "http.protocol_error",
                "http.unsupported_encoding",
                "connect.race_lost",
                "measurement.cancelled",
                "probe.resource_exhausted",
                "ipv6.unsupported",
                "profile.unsupported"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "state": {
                "enum": [
                  "skipped",
                  "unsupported"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "duration_ms": {
                "type": "null"
              }
            }
          },
          "else": {
            "properties": {
              "duration_ms": {
                "type": "number",
                "minimum": 0
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "state": {
                "enum": [
                  "ok",
                  "skipped"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "code": {
                "type": "null"
              }
            }
          },
          "else": {
            "properties": {
              "code": {
                "type": "string",
                "maxLength": 80,
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    "DNSAnswer": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "type",
        "value",
        "ttl_seconds"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 253,
          "minLength": 1
        },
        "type": {
          "enum": [
            "A",
            "AAAA",
            "CNAME"
          ]
        },
        "value": {
          "type": "string",
          "maxLength": 1024,
          "minLength": 1
        },
        "ttl_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 2147483647
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "DNSQuery": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "query_id",
        "hop_index",
        "purpose",
        "resolver_id",
        "transport",
        "name",
        "qtype",
        "phase",
        "rcode",
        "observed_at",
        "answers",
        "answers_truncated"
      ],
      "properties": {
        "query_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "hop_index": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "purpose": {
          "enum": [
            "primary",
            "control"
          ]
        },
        "resolver_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "transport": {
          "enum": [
            "udp",
            "tcp",
            "doh",
            "system"
          ]
        },
        "name": {
          "type": "string",
          "maxLength": 253,
          "minLength": 1
        },
        "qtype": {
          "enum": [
            "A",
            "AAAA"
          ]
        },
        "phase": {
          "$ref": "#/definitions/Phase"
        },
        "rcode": {
          "anyOf": [
            {
              "enum": [
                "NOERROR",
                "NXDOMAIN",
                "SERVFAIL",
                "REFUSED",
                "FORMERR",
                "NOTIMP",
                "OTHER"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "answers": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DNSAnswer"
          },
          "minItems": 0,
          "maxItems": 32
        },
        "answers_truncated": {
          "type": "boolean"
        }
      }
    },
    "Candidate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ip",
        "family",
        "source_query_ids",
        "disposition",
        "attempt_ids"
      ],
      "properties": {
        "ip": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 45,
              "format": "ipv4"
            },
            {
              "type": "string",
              "maxLength": 45,
              "format": "ipv6"
            }
          ]
        },
        "family": {
          "enum": [
            4,
            6
          ]
        },
        "source_query_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 1,
          "maxItems": 4,
          "uniqueItems": true
        },
        "disposition": {
          "enum": [
            "attempted",
            "not_selected",
            "unsupported_family",
            "policy_denied",
            "budget_exhausted"
          ]
        },
        "attempt_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 0,
          "maxItems": 12,
          "uniqueItems": true
        }
      }
    },
    "Hop": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hop_index",
        "url",
        "query_redacted",
        "resolution_ids",
        "candidates",
        "selected_attempt_id"
      ],
      "properties": {
        "hop_index": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        "query_redacted": {
          "type": "boolean"
        },
        "resolution_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 1,
          "maxItems": 4,
          "uniqueItems": true
        },
        "candidates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Candidate"
          },
          "minItems": 0,
          "maxItems": 64
        },
        "selected_attempt_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "TLS": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "phase",
        "version",
        "alpn",
        "verification",
        "cert_sha256",
        "cert_not_after"
      ],
      "properties": {
        "phase": {
          "$ref": "#/definitions/Phase"
        },
        "version": {
          "anyOf": [
            {
              "enum": [
                "TLSv1.2",
                "TLSv1.3"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "alpn": {
          "anyOf": [
            {
              "enum": [
                "http/1.1",
                "h2"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "verification": {
          "anyOf": [
            {
              "enum": [
                "valid",
                "invalid"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "cert_sha256": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "cert_not_after": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "HTTP": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "phase",
        "status_code",
        "protocol",
        "ttfb_ms",
        "content_encoding",
        "body_bytes_read",
        "body_state",
        "body_sha256",
        "redirect_to",
        "redirect_query_redacted",
        "challenge_signal"
      ],
      "properties": {
        "phase": {
          "$ref": "#/definitions/Phase"
        },
        "status_code": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 200,
              "maximum": 599
            },
            {
              "type": "null"
            }
          ]
        },
        "protocol": {
          "anyOf": [
            {
              "enum": [
                "http/1.1",
                "h2"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "ttfb_ms": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "content_encoding": {
          "anyOf": [
            {
              "enum": [
                "identity",
                "gzip",
                "unsupported"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "body_bytes_read": {
          "type": "integer",
          "minimum": 0,
          "maximum": 16384
        },
        "body_state": {
          "enum": [
            "complete",
            "prefix_only",
            "error",
            "not_read"
          ]
        },
        "body_sha256": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "redirect_to": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "redirect_query_redacted": {
          "type": "boolean"
        },
        "challenge_signal": {
          "anyOf": [
            {
              "enum": [
                "cf-mitigated-challenge"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Attempt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "attempt_id",
        "hop_index",
        "role",
        "ip",
        "family",
        "port",
        "host",
        "sni",
        "start_offset_ms",
        "duration_ms",
        "tcp",
        "tls",
        "http"
      ],
      "properties": {
        "attempt_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "hop_index": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "role": {
          "enum": [
            "primary",
            "diagnostic"
          ]
        },
        "ip": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 45,
              "format": "ipv4"
            },
            {
              "type": "string",
              "maxLength": 45,
              "format": "ipv6"
            }
          ]
        },
        "family": {
          "enum": [
            4,
            6
          ]
        },
        "port": {
          "enum": [
            80,
            443
          ]
        },
        "host": {
          "type": "string",
          "maxLength": 253,
          "minLength": 1
        },
        "sni": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 253,
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "start_offset_ms": {
          "type": "number",
          "minimum": 0
        },
        "duration_ms": {
          "type": "number",
          "minimum": 0
        },
        "tcp": {
          "$ref": "#/definitions/Phase"
        },
        "tls": {
          "$ref": "#/definitions/TLS"
        },
        "http": {
          "$ref": "#/definitions/HTTP"
        }
      }
    },
    "WorkUsed": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "elapsed_ms",
        "connects",
        "dns_wire_queries",
        "http_requests",
        "response_wire_bytes",
        "dns_wire_bytes",
        "limits_hit"
      ],
      "properties": {
        "elapsed_ms": {
          "type": "number",
          "minimum": 0
        },
        "connects": {
          "type": "integer",
          "minimum": 0,
          "maximum": 12
        },
        "dns_wire_queries": {
          "type": "integer",
          "minimum": 0,
          "maximum": 24
        },
        "http_requests": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8
        },
        "response_wire_bytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 262144
        },
        "dns_wire_bytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 131072
        },
        "limits_hit": {
          "type": "array",
          "items": {
            "enum": [
              "budget.execution",
              "budget.connections",
              "budget.http_requests",
              "budget.dns_questions",
              "budget.dns_wire_queries",
              "budget.response_bytes",
              "budget.header_bytes",
              "budget.dns_bytes",
              "budget.result_bytes",
              "diagnostic.deadline"
            ]
          },
          "minItems": 0,
          "maxItems": 16,
          "uniqueItems": true
        }
      }
    },
    "ObservationFacts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "measurement_id",
        "agent_version",
        "method_version",
        "profile",
        "environment",
        "started_at",
        "completed_at",
        "clock_offset_ms",
        "local_health",
        "resolutions",
        "hops",
        "attempts",
        "work_used",
        "diagnostic_sample_ips",
        "diagnostic_complete",
        "journey_stop"
      ],
      "properties": {
        "measurement_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "agent_version": {
          "type": "string",
          "maxLength": 80,
          "minLength": 1
        },
        "method_version": {
          "const": "go-web-2"
        },
        "profile": {
          "$ref": "#/definitions/ProfileRef"
        },
        "environment": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "runtime_version",
            "trust_store_sha256",
            "resolver_config_revision",
            "ipv4",
            "ipv6"
          ],
          "properties": {
            "runtime_version": {
              "type": "string",
              "maxLength": 80,
              "minLength": 1
            },
            "trust_store_sha256": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[0-9a-f]{64}$"
            },
            "resolver_config_revision": {
              "type": "string",
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "ipv4": {
              "type": "boolean"
            },
            "ipv6": {
              "type": "boolean"
            }
          }
        },
        "started_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "completed_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "clock_offset_ms": {
          "description": "Local wall clock minus reference UTC in milliseconds; null if unknown. Reference UTC = local timestamp - offset. Heartbeat server_time is not a clock-health source.",
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "local_health": {
          "enum": [
            "healthy",
            "degraded",
            "unknown"
          ]
        },
        "resolutions": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DNSQuery"
          },
          "minItems": 0,
          "maxItems": 12
        },
        "hops": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Hop"
          },
          "minItems": 1,
          "maxItems": 4
        },
        "attempts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Attempt"
          },
          "minItems": 0,
          "maxItems": 12
        },
        "work_used": {
          "$ref": "#/definitions/WorkUsed"
        },
        "diagnostic_sample_ips": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 45,
                "format": "ipv4"
              },
              {
                "type": "string",
                "maxLength": 45,
                "format": "ipv6"
              }
            ]
          },
          "minItems": 0,
          "maxItems": 4,
          "uniqueItems": true
        },
        "diagnostic_complete": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "journey_stop": {
          "enum": [
            "none",
            "network_error",
            "policy_stop",
            "budget_exhausted",
            "redirect_loop",
            "redirect_limit",
            "unsupported"
          ]
        }
      }
    },
    "ProbeSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "label",
        "country_code",
        "city",
        "asn",
        "network_type",
        "metadata_verified_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "label": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1
        },
        "country_code": {
          "type": "string",
          "maxLength": 2,
          "pattern": "^[A-Z]{2}$"
        },
        "city": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ]
        },
        "asn": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 4294967295
            },
            {
              "type": "null"
            }
          ]
        },
        "network_type": {
          "enum": [
            "datacenter",
            "residential",
            "mobile",
            "unknown"
          ]
        },
        "metadata_verified_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Probe": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "label",
        "country_code",
        "city",
        "asn",
        "network_type",
        "metadata_verified_at",
        "health",
        "last_seen_at",
        "ipv4",
        "ipv6",
        "profiles"
      ],
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "label": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1
        },
        "country_code": {
          "type": "string",
          "maxLength": 2,
          "pattern": "^[A-Z]{2}$"
        },
        "city": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ]
        },
        "asn": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 4294967295
            },
            {
              "type": "null"
            }
          ]
        },
        "network_type": {
          "enum": [
            "datacenter",
            "residential",
            "mobile",
            "unknown"
          ]
        },
        "metadata_verified_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "health": {
          "enum": [
            "ready",
            "degraded",
            "offline"
          ]
        },
        "last_seen_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "ipv4": {
          "type": "boolean"
        },
        "ipv6": {
          "type": "boolean"
        },
        "profiles": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ProfileRef"
          },
          "minItems": 0,
          "maxItems": 3
        }
      }
    },
    "ProbeList": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "probes",
        "next_cursor"
      ],
      "properties": {
        "probes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Probe"
          },
          "minItems": 0,
          "maxItems": 100
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 256
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Finding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "basis",
        "evidence_refs"
      ],
      "properties": {
        "code": {
          "enum": [
            "ipv6_path_failed",
            "probe.ipv6_unsupported",
            "address_race_cancelled",
            "address_tls_failed",
            "address_http_error",
            "https_downgrade",
            "target.policy_denied",
            "dns.no_addresses",
            "dns.answers_truncated",
            "address.sample_limited"
          ]
        },
        "basis": {
          "enum": [
            "observed",
            "inferred"
          ]
        },
        "evidence_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 1024,
            "pattern": "^/facts/"
          },
          "minItems": 1,
          "maxItems": 32,
          "uniqueItems": true
        }
      }
    },
    "Observation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "probe",
        "received_at",
        "quality",
        "invalid_reason",
        "outcome",
        "facts",
        "findings"
      ],
      "properties": {
        "probe": {
          "$ref": "#/definitions/ProbeSnapshot"
        },
        "received_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "quality": {
          "enum": [
            "valid",
            "invalid"
          ]
        },
        "invalid_reason": {
          "anyOf": [
            {
              "enum": [
                "clock.skew",
                "clock.unknown",
                "probe.unhealthy",
                "probe.resource_exhausted",
                "method.incompatible",
                "environment.unapproved"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "outcome": {
          "enum": [
            "success",
            "network_failure",
            "http_error",
            "access_limited",
            "inconclusive"
          ]
        },
        "facts": {
          "$ref": "#/definitions/PublicObservationFacts"
        },
        "findings": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Finding"
          },
          "minItems": 0,
          "maxItems": 32
        }
      }
    },
    "Coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "expected",
        "received",
        "usable",
        "missing_probe_ids",
        "excluded",
        "complete",
        "known_asn_count",
        "unknown_asn_probe_ids"
      ],
      "properties": {
        "expected": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10
        },
        "received": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "usable": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "missing_probe_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 0,
          "maxItems": 10,
          "uniqueItems": true
        },
        "excluded": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "probe_id",
              "reason"
            ],
            "properties": {
              "probe_id": {
                "type": "string",
                "maxLength": 128,
                "minLength": 1,
                "pattern": "^[a-zA-Z0-9_-]+$"
              },
              "reason": {
                "enum": [
                  "invalid",
                  "inconclusive",
                  "stale",
                  "incompatible"
                ]
              }
            }
          },
          "minItems": 0,
          "maxItems": 10
        },
        "complete": {
          "type": "boolean"
        },
        "known_asn_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "unknown_asn_probe_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 0,
          "maxItems": 10,
          "uniqueItems": true
        }
      }
    },
    "Freshness": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "max_age_seconds",
        "oldest_observed_at",
        "newest_observed_at"
      ],
      "properties": {
        "state": {
          "enum": [
            "fresh",
            "mixed",
            "stale",
            "unknown"
          ]
        },
        "max_age_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 900
        },
        "oldest_observed_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "newest_observed_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Summary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "last_observed_status",
        "reason_code",
        "title",
        "detail",
        "scope"
      ],
      "properties": {
        "status": {
          "enum": [
            "available",
            "degraded",
            "unavailable",
            "site_error",
            "restricted",
            "insufficient_data"
          ]
        },
        "last_observed_status": {
          "enum": [
            "available",
            "degraded",
            "unavailable",
            "site_error",
            "restricted",
            "insufficient_data"
          ]
        },
        "reason_code": {
          "enum": [
            "all_succeeded",
            "mixed_outcomes",
            "all_network_failed",
            "all_http_error",
            "all_access_limited",
            "no_usable_observations"
          ]
        },
        "title": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1
        },
        "detail": {
          "type": "string",
          "maxLength": 1000,
          "minLength": 1
        },
        "scope": {
          "const": "selected_probes"
        },
        "observed_stop": {
          "type": "string",
          "enum": [
            "redirect_loop",
            "redirect_limit",
            "policy_stop",
            "budget_exhausted",
            "unsupported"
          ],
          "description": "Common diagnostic stop of all received valid inconclusive observations in a comparable window. Does not assert availability. Optional for legacy records."
        }
      }
    },
    "Report": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "report_id",
        "visibility",
        "detail_level",
        "target",
        "profile",
        "method_version",
        "ruleset_version",
        "expected_probe_ids",
        "evaluated_at",
        "window",
        "freshness",
        "coverage",
        "summary",
        "links"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "report_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "visibility": {
          "enum": [
            "public",
            "private"
          ]
        },
        "detail_level": {
          "enum": [
            "summary",
            "full"
          ]
        },
        "target": {
          "$ref": "#/definitions/Target"
        },
        "profile": {
          "$ref": "#/definitions/ProfileRef"
        },
        "method_version": {
          "const": "go-web-2"
        },
        "ruleset_version": {
          "const": "availability-1"
        },
        "expected_probe_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 1,
          "maxItems": 10,
          "uniqueItems": true
        },
        "evaluated_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "window": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "first_started_at",
            "last_finished_at",
            "max_span_seconds"
          ],
          "properties": {
            "first_started_at": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 40,
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "last_finished_at": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 40,
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "max_span_seconds": {
              "enum": [
                60,
                90
              ]
            }
          }
        },
        "freshness": {
          "$ref": "#/definitions/Freshness"
        },
        "coverage": {
          "$ref": "#/definitions/Coverage"
        },
        "summary": {
          "$ref": "#/definitions/Summary"
        },
        "observations": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Observation"
          },
          "minItems": 0,
          "maxItems": 10
        },
        "links": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "self",
            "details"
          ],
          "properties": {
            "self": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            },
            "details": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            }
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "detail_level": {
                "const": "full"
              }
            }
          },
          "then": {
            "required": [
              "observations"
            ]
          },
          "else": {
            "not": {
              "required": [
                "observations"
              ]
            }
          }
        }
      ]
    },
    "Usage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "billing_mode",
        "source",
        "reserved_units",
        "pending_units",
        "consumed_units",
        "released_units"
      ],
      "properties": {
        "billing_mode": {
          "const": "quota_only"
        },
        "source": {
          "enum": [
            "fresh",
            "shared",
            "cache"
          ]
        },
        "reserved_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 40
        },
        "pending_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 40
        },
        "consumed_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 40
        },
        "released_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 40
        }
      }
    },
    "Check": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "check_id",
        "state",
        "created_at",
        "deadline_at",
        "finished_at",
        "failure_code",
        "target",
        "profile",
        "resolved_probe_ids",
        "usage",
        "result",
        "links"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "check_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "state": {
          "enum": [
            "queued",
            "running",
            "completed",
            "expired",
            "failed"
          ]
        },
        "created_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "deadline_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "finished_at": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40,
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "failure_code": {
          "anyOf": [
            {
              "enum": [
                "platform.internal",
                "platform.storage_unavailable",
                "platform.scheduler_unavailable"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "target": {
          "$ref": "#/definitions/Target"
        },
        "profile": {
          "$ref": "#/definitions/ProfileRef"
        },
        "resolved_probe_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "minItems": 1,
          "maxItems": 10,
          "uniqueItems": true
        },
        "usage": {
          "$ref": "#/definitions/Usage"
        },
        "result": {
          "$ref": "#/definitions/Report"
        },
        "links": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "self",
            "result"
          ],
          "properties": {
            "self": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            },
            "result": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            }
          }
        }
      }
    },
    "Problem": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "title",
        "status",
        "detail",
        "instance",
        "code",
        "request_id",
        "retryable",
        "retry_after_seconds"
      ],
      "properties": {
        "type": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        "title": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1
        },
        "status": {
          "type": "integer",
          "minimum": 400,
          "maximum": 599
        },
        "detail": {
          "type": "string",
          "maxLength": 1000
        },
        "instance": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri-reference"
        },
        "code": {
          "enum": [
            "invalid_json",
            "unauthenticated",
            "forbidden",
            "not_found",
            "idempotency_conflict",
            "plan_expired",
            "plan_stale",
            "plan_consumed",
            "result_conflict",
            "stale_lease",
            "lease_expired",
            "details_expired",
            "payload_too_large",
            "invalid_target",
            "scheme_required",
            "unsupported_profile",
            "incompatible_probe",
            "probe_unavailable",
            "budget_exceeded",
            "result_invalid",
            "quota_exceeded",
            "rate_limited",
            "platform_unavailable",
            "coverage_unavailable"
          ]
        },
        "request_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "retryable": {
          "type": "boolean"
        },
        "retry_after_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 86400
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Capabilities": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "billing_mode",
        "presets",
        "limits",
        "links"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "billing_mode": {
          "const": "quota_only"
        },
        "presets": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "probe_ids",
              "selection_revision"
            ],
            "properties": {
              "id": {
                "const": "ru-core"
              },
              "probe_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 128,
                  "minLength": 1,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "minItems": 1,
                "maxItems": 10,
                "uniqueItems": true
              },
              "selection_revision": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          "minItems": 0,
          "maxItems": 1
        },
        "limits": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "max_probes_per_check",
            "max_concurrent_checks",
            "daily_units",
            "create_requests_per_minute",
            "read_requests_per_minute"
          ],
          "properties": {
            "max_probes_per_check": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10
            },
            "max_concurrent_checks": {
              "type": "integer",
              "minimum": 1
            },
            "daily_units": {
              "type": "integer",
              "minimum": 0
            },
            "create_requests_per_minute": {
              "type": "integer",
              "minimum": 1
            },
            "read_requests_per_minute": {
              "type": "integer",
              "minimum": 1
            }
          }
        },
        "links": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "profiles",
            "probes",
            "openapi"
          ],
          "properties": {
            "profiles": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            },
            "probes": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            },
            "openapi": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri-reference"
            }
          }
        }
      }
    },
    "AcquireRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "boot_id",
        "capacity",
        "wait_seconds"
      ],
      "properties": {
        "boot_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "capacity": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        },
        "wait_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 20
        }
      }
    },
    "Lease": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "lease_id",
        "task_id",
        "generation",
        "probe_id",
        "issued_at",
        "ack_deadline_at",
        "execution_deadline_at",
        "expires_at",
        "check_deadline_at",
        "target",
        "profile"
      ],
      "properties": {
        "lease_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "task_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "generation": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        },
        "probe_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "issued_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "ack_deadline_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "execution_deadline_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "expires_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "check_deadline_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "target": {
          "$ref": "#/definitions/ExecutionTarget"
        },
        "profile": {
          "$ref": "#/definitions/Profile"
        }
      }
    },
    "AcquireResponse": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "leases",
        "retry_after_seconds"
      ],
      "properties": {
        "leases": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Lease"
          },
          "minItems": 0,
          "maxItems": 2
        },
        "retry_after_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 60
        }
      }
    },
    "AckRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "generation",
        "boot_id"
      ],
      "properties": {
        "generation": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        },
        "boot_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        }
      }
    },
    "AckResponse": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "lease_id",
        "generation"
      ],
      "properties": {
        "status": {
          "const": "acknowledged"
        },
        "lease_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "generation": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        }
      }
    },
    "AgentResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "generation",
        "observation"
      ],
      "properties": {
        "generation": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        },
        "observation": {
          "$ref": "#/definitions/ObservationFacts"
        }
      }
    },
    "ResultAck": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "measurement_id"
      ],
      "properties": {
        "status": {
          "enum": [
            "accepted",
            "duplicate",
            "late_ignored"
          ]
        },
        "measurement_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        }
      }
    },
    "HeartbeatRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "boot_id",
        "agent_version",
        "profiles",
        "ipv4",
        "ipv6",
        "local_health",
        "clock_offset_ms",
        "active_executions",
        "spool_results",
        "spool_bytes"
      ],
      "properties": {
        "boot_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "agent_version": {
          "type": "string",
          "maxLength": 80,
          "minLength": 1
        },
        "profiles": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ProfileRef"
          },
          "minItems": 1,
          "maxItems": 3
        },
        "ipv4": {
          "type": "boolean"
        },
        "ipv6": {
          "type": "boolean"
        },
        "local_health": {
          "enum": [
            "healthy",
            "degraded",
            "unknown"
          ]
        },
        "clock_offset_ms": {
          "description": "Local wall clock minus reference UTC in milliseconds; null if unknown. Reference UTC = local timestamp - offset. Heartbeat server_time is not a clock-health source.",
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "active_executions": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "description": "Active measurements on this probe, bounded at 10. Acquire capacity is a separate per-request batch limit of 2."
        },
        "spool_results": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "spool_bytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10485760
        }
      }
    },
    "HeartbeatResponse": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "server_time",
        "next_heartbeat_seconds"
      ],
      "properties": {
        "server_time": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "next_heartbeat_seconds": {
          "const": 60
        }
      }
    },
    "PublicObservationFacts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "measurement_id",
        "method_version",
        "profile",
        "environment",
        "started_at",
        "completed_at",
        "clock_offset_ms",
        "local_health",
        "resolutions",
        "hops",
        "attempts",
        "work_used",
        "diagnostic_sample_ips",
        "diagnostic_complete",
        "journey_stop"
      ],
      "properties": {
        "measurement_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "method_version": {
          "const": "go-web-2"
        },
        "profile": {
          "$ref": "#/definitions/ProfileRef"
        },
        "environment": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "ipv4",
            "ipv6"
          ],
          "properties": {
            "ipv4": {
              "type": "boolean"
            },
            "ipv6": {
              "type": "boolean"
            }
          }
        },
        "started_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "completed_at": {
          "type": "string",
          "maxLength": 40,
          "format": "date-time"
        },
        "clock_offset_ms": {
          "description": "Local wall clock minus reference UTC in milliseconds; null if unknown. Reference UTC = local timestamp - offset. Heartbeat server_time is not a clock-health source.",
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "local_health": {
          "enum": [
            "healthy",
            "degraded",
            "unknown"
          ]
        },
        "resolutions": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DNSQuery"
          },
          "minItems": 0,
          "maxItems": 12
        },
        "hops": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Hop"
          },
          "minItems": 1,
          "maxItems": 4
        },
        "attempts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Attempt"
          },
          "minItems": 0,
          "maxItems": 12
        },
        "work_used": {
          "$ref": "#/definitions/WorkUsed"
        },
        "diagnostic_sample_ips": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 45,
                "format": "ipv4"
              },
              {
                "type": "string",
                "maxLength": 45,
                "format": "ipv6"
              }
            ]
          },
          "minItems": 0,
          "maxItems": 4,
          "uniqueItems": true
        },
        "diagnostic_complete": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "journey_stop": {
          "enum": [
            "none",
            "network_error",
            "policy_stop",
            "budget_exhausted",
            "redirect_loop",
            "redirect_limit",
            "unsupported"
          ]
        }
      },
      "description": "Public measurement evidence. Operational agent/runtime versions, CA fingerprint and resolver configuration revision remain internal."
    },
    "RootSummary": {
      "allOf": [
        {
          "$ref": "#/definitions/Report"
        },
        {
          "properties": {
            "visibility": {
              "const": "public"
            },
            "detail_level": {
              "const": "summary"
            },
            "profile": {
              "properties": {
                "id": {
                  "const": "web-basic-v1"
                }
              }
            },
            "target": {
              "properties": {
                "query_redacted": {
                  "const": false
                },
                "scheme": {
                  "const": "https"
                },
                "port": {
                  "const": 443
                }
              }
            }
          }
        }
      ]
    },
    "CatalogueItem": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "domain",
        "name",
        "latest"
      ],
      "properties": {
        "domain": {
          "type": "string",
          "minLength": 3,
          "maxLength": 253,
          "pattern": "^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "latest": {
          "anyOf": [
            {
              "$ref": "#/definitions/RootSummary"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "CataloguePage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "items",
        "next_cursor"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CatalogueItem"
          },
          "maxItems": 100
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 3,
              "maxLength": 253,
              "pattern": "^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "CatalogueHistory": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "domain",
        "name",
        "history",
        "next_cursor"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "domain": {
          "type": "string",
          "minLength": 3,
          "maxLength": 253,
          "pattern": "^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "history": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RootSummary"
          },
          "maxItems": 50
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "timeline": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "report_id",
              "probe_id",
              "label",
              "observed_at",
              "quality",
              "outcome"
            ],
            "properties": {
              "report_id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,128}$",
                "maxLength": 128
              },
              "probe_id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,128}$",
                "maxLength": 128
              },
              "label": {
                "type": "string",
                "maxLength": 120
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "quality": {
                "enum": [
                  "valid",
                  "invalid"
                ]
              },
              "outcome": {
                "enum": [
                  "success",
                  "network_failure",
                  "http_error",
                  "access_limited",
                  "inconclusive"
                ]
              },
              "journey_stop": {
                "type": "string",
                "enum": [
                  "redirect_loop",
                  "redirect_limit",
                  "policy_stop",
                  "budget_exhausted",
                  "unsupported"
                ],
                "description": "Observed diagnostic stop for a valid inconclusive point, if retained. Absence does not imply a successful journey."
              }
            }
          }
        }
      }
    },
    "PublishRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "Publication": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "publication_version",
        "publication_id",
        "masked_name",
        "published_at",
        "observed_at",
        "status",
        "expected",
        "received",
        "usable"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "publication_version": {
          "const": 2
        },
        "publication_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "masked_name": {
          "type": "string",
          "maxLength": 253,
          "pattern": "^(\\*\\*\\*|[a-z0-9-]+\\*\\*\\*[a-z0-9-]+\\.[a-z0-9.-]+)$"
        },
        "published_at": {
          "type": "string",
          "format": "date-time",
          "maxLength": 40
        },
        "observed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "maxLength": 40
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "enum": [
            "available",
            "degraded",
            "unavailable",
            "site_error",
            "restricted",
            "insufficient_data"
          ]
        },
        "expected": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10
        },
        "received": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "usable": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        }
      },
      "description": "Masked publication v2: no target, hostname, URL, target key, observations or private report. status is historical at observed_at, never a safety or legality assessment. Owner reads the original private Report separately."
    },
    "PublicationPage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "items",
        "next_cursor"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Publication"
          },
          "maxItems": 20
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "AbuseRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "subject_type",
        "subject_id",
        "reason",
        "child_safety"
      ],
      "properties": {
        "subject_type": {
          "enum": [
            "publication",
            "catalogue"
          ]
        },
        "subject_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 253,
          "pattern": "^[a-zA-Z0-9_.-]+$"
        },
        "reason": {
          "enum": [
            "phishing",
            "malware",
            "suspected_illegal",
            "spam"
          ]
        },
        "child_safety": {
          "type": "boolean"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "child_safety": {
                "const": true
              }
            }
          },
          "then": {
            "properties": {
              "reason": {
                "const": "suspected_illegal"
              }
            }
          }
        }
      ]
    },
    "AbuseReceipt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "receipt_id",
        "state"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "receipt_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "state": {
          "const": "received"
        }
      }
    },
    "PublicationWithdrawal": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "publication_id",
        "state"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "publication_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "state": {
          "const": "withdrawn"
        }
      }
    },
    "ActivityPage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "items",
        "refresh_after_seconds"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "items": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "activity_id",
                  "created_at",
                  "visibility"
                ],
                "properties": {
                  "activity_id": {
                    "type": "string",
                    "pattern": "^a_[0-9a-f]{64}$"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "visibility": {
                    "const": "private"
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "activity_id",
                  "created_at",
                  "visibility",
                  "publication"
                ],
                "properties": {
                  "activity_id": {
                    "type": "string",
                    "pattern": "^a_[0-9a-f]{64}$"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "visibility": {
                    "const": "public"
                  },
                  "publication": {
                    "$ref": "#/definitions/Publication"
                  }
                }
              }
            ]
          }
        },
        "refresh_after_seconds": {
          "const": 10
        }
      }
    },
    "BrowserObservationRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "request_id",
        "domain",
        "outcome",
        "duration_ms",
        "consent"
      ],
      "properties": {
        "request_id": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,128}$",
          "maxLength": 128,
          "minLength": 16
        },
        "domain": {
          "type": "string",
          "minLength": 1,
          "maxLength": 253
        },
        "outcome": {
          "enum": [
            "response",
            "unconfirmed",
            "timeout"
          ]
        },
        "duration_ms": {
          "type": "integer",
          "minimum": 0,
          "maximum": 60000
        },
        "consent": {
          "const": true
        }
      }
    },
    "BrowserObservationReceipt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "received_at",
        "evidence",
        "accepted"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "received_at": {
          "type": "string",
          "format": "date-time"
        },
        "evidence": {
          "const": "unverified_browser"
        },
        "accepted": {
          "const": true
        }
      }
    },
    "BrowserObservationSummary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "domain",
        "evidence",
        "since",
        "until",
        "response",
        "unconfirmed",
        "timeout"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0-draft.2"
        },
        "domain": {
          "type": "string",
          "minLength": 1,
          "maxLength": 253
        },
        "evidence": {
          "const": "unverified_browser"
        },
        "since": {
          "type": "string",
          "format": "date-time"
        },
        "until": {
          "type": "string",
          "format": "date-time"
        },
        "response": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4000
        },
        "unconfirmed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4000
        },
        "timeout": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4000
        }
      }
    }
  }
}
