{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.verisk.com/schemas/property-risk",
  "title": "Verisk Property Risk Assessment",
  "description": "A property risk assessment from Verisk insurance analytics including construction data, fire protection, and peril scores",
  "type": "object",
  "properties": {
    "propertyId": {
      "type": "string",
      "description": "Unique Verisk property identifier"
    },
    "address": {
      "$ref": "#/$defs/Address"
    },
    "coordinates": {
      "$ref": "#/$defs/Coordinates"
    },
    "construction": {
      "$ref": "#/$defs/ConstructionData"
    },
    "fireProtection": {
      "$ref": "#/$defs/FireProtectionClass"
    },
    "perilScores": {
      "type": "object",
      "description": "Risk scores keyed by peril type",
      "properties": {
        "FIRE": {"$ref": "#/$defs/PerilScore"},
        "WIND": {"$ref": "#/$defs/PerilScore"},
        "HAIL": {"$ref": "#/$defs/PerilScore"},
        "FLOOD": {"$ref": "#/$defs/PerilScore"},
        "EARTHQUAKE": {"$ref": "#/$defs/PerilScore"},
        "WILDFIRE": {"$ref": "#/$defs/PerilScore"},
        "HURRICANE": {"$ref": "#/$defs/PerilScore"}
      },
      "additionalProperties": {
        "$ref": "#/$defs/PerilScore"
      }
    },
    "lastUpdated": {
      "type": "string",
      "format": "date",
      "description": "Date when risk data was last updated"
    }
  },
  "required": ["propertyId", "address"],
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "street": {"type": "string"},
        "city": {"type": "string"},
        "state": {
          "type": "string",
          "pattern": "^[A-Z]{2}$",
          "description": "US state abbreviation"
        },
        "zipCode": {"type": "string"},
        "country": {
          "type": "string",
          "default": "US"
        }
      },
      "required": ["street", "city", "state"]
    },
    "Coordinates": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "required": ["latitude", "longitude"]
    },
    "ConstructionData": {
      "type": "object",
      "properties": {
        "yearBuilt": {
          "type": "integer",
          "minimum": 1800,
          "maximum": 2030
        },
        "squareFootage": {
          "type": "integer",
          "minimum": 0
        },
        "stories": {
          "type": "integer",
          "minimum": 1
        },
        "constructionType": {
          "type": "string",
          "enum": ["FRAME", "MASONRY", "FIRE_RESISTIVE", "MODIFIED_FIRE_RESISTIVE", "JOISTED_MASONRY", "NON_COMBUSTIBLE"],
          "description": "ISO construction class"
        },
        "roofType": {
          "type": "string",
          "enum": ["SHINGLE", "TILE", "METAL", "FLAT", "SLATE"]
        },
        "occupancyType": {
          "type": "string",
          "enum": ["RESIDENTIAL", "COMMERCIAL", "INDUSTRIAL", "MIXED_USE"]
        }
      }
    },
    "FireProtectionClass": {
      "type": "object",
      "description": "ISO Public Protection Classification (PPC) data",
      "properties": {
        "ppcGrade": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "description": "PPC grade from 1 (best fire protection) to 10 (no protection)"
        },
        "splitCode": {
          "type": "string",
          "description": "Split classification code (e.g., 4/9)"
        },
        "fireDistrictName": {
          "type": "string"
        },
        "distanceToFireStation": {
          "type": "number",
          "minimum": 0,
          "description": "Distance to nearest fire station in miles"
        },
        "distanceToHydrant": {
          "type": "number",
          "minimum": 0,
          "description": "Distance to nearest hydrant in feet"
        },
        "lastSurveyDate": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "PerilScore": {
      "type": "object",
      "description": "Risk score for a single natural hazard peril",
      "properties": {
        "score": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "description": "Relative risk score from 1 (lowest) to 100 (highest)"
        },
        "riskCategory": {
          "type": "string",
          "enum": ["VERY_LOW", "LOW", "MODERATE", "HIGH", "VERY_HIGH", "EXTREME"]
        },
        "annualExceedanceProbability": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Annual probability of exceeding the loss threshold"
        },
        "description": {
          "type": "string"
        }
      }
    }
  }
}
