{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://timezoneexplorer.com/geotz/geotz-v0.1.schema.json",
  "title": "GeoTZ v0.1 authority dataset",
  "description": "A complete-sphere, provenance-aware spatial companion to IANA tzdb 2026c.",
  "type": "object",
  "required": ["type", "metadata", "features"],
  "properties": {
    "type": { "const": "FeatureCollection" },
    "metadata": {
      "type": "object",
      "required": ["authority_version", "standard_version", "compatible_tzdb", "generated", "geometry_source", "temporal_rules", "coverage_model", "boundary_policy", "antimeridian_policy", "polar_policy", "assignment_classes", "feature_count"],
      "properties": {
        "authority_version": { "type": "integer", "minimum": 1 },
        "standard_version": { "const": "geotz-v0.1" },
        "compatible_tzdb": { "const": "2026c" },
        "generated": { "type": "string", "format": "date-time" },
        "geometry_source": { "type": "string", "minLength": 1 },
        "temporal_rules": { "type": "string", "minLength": 1 },
        "coverage_model": { "type": "string", "minLength": 1 },
        "boundary_policy": { "type": "string", "minLength": 1 },
        "antimeridian_policy": { "type": "string", "minLength": 1 },
        "polar_policy": { "type": "string", "minLength": 1 },
        "assignment_classes": {
          "type": "array",
          "prefixItems": [
            { "const": "civil" }, { "const": "maritime" },
            { "const": "operational" }, { "const": "derived" }
          ],
          "items": false
        },
        "feature_count": { "type": "integer", "minimum": 1 }
      },
      "additionalProperties": true
    },
    "features": {
      "type": "array",
      "items": { "$ref": "#/$defs/feature" }
    }
  },
  "$defs": {
    "position": {
      "type": "array", "prefixItems": [{ "type": "number", "minimum": -180, "maximum": 180 }, { "type": "number", "minimum": -90, "maximum": 90 }], "minItems": 2
    },
    "feature": {
      "type": "object",
      "required": ["type", "properties", "geometry"],
      "properties": {
        "type": { "const": "Feature" },
        "properties": {
          "type": "object",
          "required": ["authority_id", "authority_role", "authority_priority", "authority_source"],
          "properties": {
            "authority_id": { "type": "string", "minLength": 1 },
            "authority_role": { "enum": ["timezone", "country", "date_shift"] },
            "authority_priority": { "type": "number" },
            "authority_source": { "type": "string", "minLength": 1 },
            "tzid": { "type": "string", "minLength": 1 },
            "assignment_basis": { "enum": ["civil", "maritime", "operational", "derived"] },
            "evidence_class": { "enum": ["official", "documented", "mapped", "derived"] },
            "authority_radius_km": { "type": "number", "exclusiveMinimum": 0 },
            "shift_hours": { "type": "integer" }
          },
          "allOf": [
            { "if": { "properties": { "authority_role": { "const": "timezone" } } }, "then": { "required": ["tzid", "assignment_basis", "evidence_class"] } },
            { "if": { "properties": { "authority_role": { "const": "date_shift" } } }, "then": { "required": ["shift_hours"] } }
          ],
          "additionalProperties": true
        },
        "geometry": {
          "oneOf": [
            { "type": "object", "required": ["type", "coordinates"], "properties": { "type": { "const": "Point" }, "coordinates": { "$ref": "#/$defs/position" } } },
            { "type": "object", "required": ["type", "coordinates"], "properties": { "type": { "const": "Polygon" }, "coordinates": { "type": "array" } } },
            { "type": "object", "required": ["type", "coordinates"], "properties": { "type": { "const": "MultiPolygon" }, "coordinates": { "type": "array" } } }
          ]
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
