{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "soilKey site metadata extraction schema",
  "description": "Schema for VLM-extracted site-level metadata from field sheets / cover pages. Mirrors the PedonRecord$site list. Each value-bearing attribute carries confidence and source_quote alongside the value. NA / not-stated -> null. The VLM never classifies; it only extracts.",
  "type": "object",
  "properties": {
    "site": {
      "type": "object",
      "properties": {
        "id": {
          "type": ["string", "null"]
        },
        "lat": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "number", "minimum": -90, "maximum": 90},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "lon": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "number", "minimum": -180, "maximum": 180},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "crs": {
          "type": ["integer", "null"]
        },
        "date": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string", "format": "date"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "country": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "elevation_m": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "number", "minimum": -500, "maximum": 9000},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "slope_pct": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "number", "minimum": 0, "maximum": 200},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "aspect_deg": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "number", "minimum": 0, "maximum": 360},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "landform": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "parent_material": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "land_use": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "vegetation": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        },
        "drainage_class": {
          "type": ["object", "null"],
          "properties": {
            "value": {"type": "string"},
            "confidence": {"type": "number", "minimum": 0, "maximum": 1},
            "source_quote": {"type": "string", "maxLength": 200}
          },
          "required": ["value", "confidence"]
        }
      }
    }
  },
  "required": ["site"]
}
