{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Beacon campus location estimates",
  "description": "IP candidates never establish presence. Device estimates require permission, current accuracy and a fully contained uncertainty circle. Registry boundaries are community mapped; no employment or enrollment assertion.",
  "$defs": {
    "LocationEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source",
        "latitude",
        "longitude",
        "observedAtMs"
      ],
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "ip",
            "device"
          ]
        },
        "latitude": {
          "type": "number",
          "minimum": -85,
          "maximum": 85
        },
        "longitude": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "observedAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "accuracyMeters": {
          "type": "number",
          "minimum": 0,
          "maximum": 20000000
        },
        "gridDegrees": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "permission": {
          "type": "string",
          "enum": [
            "granted",
            "denied",
            "prompt"
          ]
        },
        "countryCode": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      }
    },
    "CampusCandidate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "campusId",
        "name",
        "organization",
        "status",
        "basis",
        "reason",
        "distanceToBoundaryMeters",
        "sourceUrl"
      ],
      "properties": {
        "campusId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "area_candidate",
            "location_match"
          ]
        },
        "basis": {
          "type": "string",
          "enum": [
            "ip_estimate",
            "permissioned_device"
          ]
        },
        "reason": {
          "type": "string"
        },
        "distanceToBoundaryMeters": {
          "type": "number"
        },
        "sourceUrl": {
          "type": "string"
        }
      }
    },
    "CampusLocation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "registryVersion",
        "status",
        "reason",
        "matches"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "registryVersion": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "unavailable",
            "candidates",
            "no_candidate"
          ]
        },
        "reason": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "enum": [
            "ip",
            "device"
          ]
        },
        "observedAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "searchRadiusMeters": {
          "type": "number"
        },
        "accuracyKnown": {
          "type": "boolean"
        },
        "accuracyMeters": {
          "type": "number"
        },
        "matches": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CampusCandidate"
          }
        }
      }
    },
    "OfficeAreaCandidate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "officeId",
        "name",
        "city",
        "status",
        "coordinateStatus",
        "distanceToPointMeters",
        "sourceUrl"
      ],
      "properties": {
        "officeId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "area_candidate"
          ]
        },
        "coordinateStatus": {
          "type": "string"
        },
        "distanceToPointMeters": {
          "type": "number",
          "minimum": 0
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "OfficeAreaResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "registryVersion",
        "status",
        "reason",
        "matches"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "registryVersion": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "unavailable",
            "candidates",
            "no_candidate"
          ]
        },
        "reason": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "enum": [
            "ip",
            "device"
          ]
        },
        "observedAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "searchRadiusMeters": {
          "type": "number"
        },
        "accuracyKnown": {
          "type": "boolean"
        },
        "accuracyMeters": {
          "type": "number"
        },
        "matches": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OfficeAreaCandidate"
          }
        },
        "proximityMeters": {
          "type": "number",
          "minimum": 0,
          "maximum": 5000
        }
      }
    }
  }
}
