{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/Risk",
  "definitions": {
    "Risk": {
      "type": "object",
      "properties": {
        "resourceType": {
          "type": "string",
          "const": "Risk",
          "description": "Fixed resource type discriminator"
        },
        "id": {
          "type": "string",
          "description": "Logical id of this resource. Assigned by the server or originating system."
        },
        "meta": {
          "$ref": "#/definitions/Meta",
          "description": "Metadata about the resource"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "inactive",
            "pending",
            "disposed"
          ],
          "description": "Current status of this risk item"
        },
        "riskType": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The type of insurable risk. Examples: vehicle, property, marine-cargo, professional-liability, cyber, workers-comp-class, equipment, fine-art, livestock."
        },
        "description": {
          "type": "string",
          "description": "Free-text description of the risk"
        },
        "insured": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the insured who owns or is responsible for this risk"
        },
        "location": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the physical location of this risk (for property-based risks)"
        },
        "characteristics": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RiskCharacteristic"
          },
          "description": "Structured attributes of the risk (polymorphic value pattern)"
        },
        "values": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/AssetValuation"
          },
          "description": "Financial valuations of the risk"
        },
        "classifications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CodeableConcept"
          },
          "description": "Risk classifications (e.g., ISO class codes, NAICS codes, fleet codes)"
        },
        "effectivePeriod": {
          "$ref": "#/definitions/Period",
          "description": "Period during which this risk is/was active or covered"
        },
        "coverages": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Reference"
          },
          "description": "References to Coverage resources that cover this risk"
        },
        "partOf": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to a parent risk (e.g., equipment within a building, trailer attached to a vehicle)"
        },
        "notes": {
          "type": "string",
          "description": "Free-text notes about this risk"
        },
        "namedDrivers": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/NamedDriver"
          },
          "description": "Named drivers on a personal auto policy risk"
        },
        "lienholders": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Lienholder"
          },
          "description": "Financial interest parties (lienholders, loss payees) on this risk"
        },
        "garagingAddress": {
          "$ref": "#/definitions/Address",
          "description": "Primary garaging location for mobile risks (vehicles, trailers)"
        }
      },
      "required": [
        "resourceType",
        "riskType",
        "status"
      ],
      "additionalProperties": false,
      "description": "An insurable risk item — the most architecturally significant domain resource.\n- `riskType` identifies what kind of insurable thing this is\n- `characteristics[]` capture structured attributes\n- `values[]` capture financial valuations\n\nRisk is deliberately generic to handle vehicles, properties, marine cargo, professional liability exposures, cyber risks, workers' comp classes, equipment, etc.",
      "examples": [
        {
          "resourceType": "Risk",
          "id": "risk-veh-001",
          "status": "active",
          "riskType": {
            "coding": [
              {
                "code": "vehicle",
                "display": "Vehicle"
              }
            ]
          },
          "characteristics": [
            {
              "code": {
                "text": "VIN"
              },
              "valueString": "1HGBH41JXMN109186"
            },
            {
              "code": {
                "text": "Year"
              },
              "valueInteger": 2023
            },
            {
              "code": {
                "text": "Make"
              },
              "valueString": "Honda"
            },
            {
              "code": {
                "text": "Model"
              },
              "valueString": "Civic"
            }
          ],
          "values": [
            {
              "type": {
                "text": "Stated Value"
              },
              "amount": {
                "value": 28000,
                "currency": "USD"
              }
            }
          ]
        }
      ]
    },
    "Meta": {
      "type": "object",
      "properties": {
        "versionId": {
          "type": "string",
          "description": "Version-specific identifier for this resource version. Changes each time the resource is updated."
        },
        "lastUpdated": {
          "type": "string",
          "description": "When this resource was last updated.",
          "format": "date-time"
        },
        "source": {
          "type": "string",
          "description": "URI identifying the originating system that created or last modified this resource.",
          "format": "uri"
        },
        "tag": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Coding"
          },
          "description": "Security or access control tags"
        }
      },
      "additionalProperties": false,
      "description": "Metadata about a resource instance. Tracks versioning, provenance, and timestamps."
    },
    "Coding": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string",
          "description": "The code system URI that defines the code.",
          "format": "uri"
        },
        "code": {
          "type": "string",
          "description": "The code value from the code system"
        },
        "display": {
          "type": "string",
          "description": "Human-readable display text for the code"
        }
      },
      "required": [
        "code"
      ],
      "additionalProperties": false,
      "description": "A coded value from a defined code system. Used throughout BIND for standardized enumerations.",
      "examples": [
        {
          "system": "https://bind.codes/line-of-business",
          "code": "GL",
          "display": "General Liability"
        }
      ]
    },
    "CodeableConcept": {
      "type": "object",
      "properties": {
        "coding": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Coding"
          },
          "description": "Code(s) from formal code systems"
        },
        "text": {
          "type": "string",
          "description": "Plain text representation of the concept"
        }
      },
      "additionalProperties": false,
      "description": "A concept with a coding and optional text. Wraps one or more Coding values with a human-readable summary."
    },
    "Reference": {
      "type": "object",
      "properties": {
        "reference": {
          "type": "string",
          "description": "Relative or absolute reference to another resource. Format: `{ResourceType}/{id}` for relative references."
        },
        "type": {
          "type": "string",
          "description": "The resource type being referenced"
        },
        "display": {
          "type": "string",
          "description": "Text alternative for the reference (e.g. display name)"
        }
      },
      "additionalProperties": false,
      "description": "A reference from one BIND resource to another.",
      "examples": [
        {
          "reference": "Insured/ins-789",
          "display": "Acme Corp"
        }
      ]
    },
    "RiskCharacteristic": {
      "type": "object",
      "properties": {
        "code": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "What aspect of the risk this characteristic describes (VIN, Make, Year, Construction Type, etc.)"
        },
        "valueString": {
          "type": "string",
          "description": "String value"
        },
        "valueInteger": {
          "type": "number",
          "description": "Integer value"
        },
        "valueDecimal": {
          "type": "number",
          "description": "Decimal value"
        },
        "valueBoolean": {
          "type": "boolean",
          "description": "Boolean value"
        },
        "valueCodeableConcept": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Coded concept value"
        },
        "valueQuantity": {
          "$ref": "#/definitions/Quantity",
          "description": "Quantity value (with units)"
        },
        "valueMoney": {
          "$ref": "#/definitions/Money",
          "description": "Monetary value"
        },
        "valueCoding": {
          "$ref": "#/definitions/Coding",
          "description": "Coded value (single code, no text)"
        },
        "valuePeriod": {
          "$ref": "#/definitions/Period",
          "description": "Time period value"
        }
      },
      "required": [
        "code"
      ],
      "additionalProperties": false,
      "description": "A structured characteristic of a risk item. Uses a polymorphic value pattern — exactly one `value*` field should be populated per characteristic.",
      "examples": [
        {
          "code": {
            "text": "Construction Type"
          },
          "valueCodeableConcept": {
            "text": "Fire Resistive"
          }
        },
        {
          "code": {
            "text": "Year Built"
          },
          "valueInteger": 1995
        },
        {
          "code": {
            "text": "Sprinklered"
          },
          "valueBoolean": true
        }
      ]
    },
    "Quantity": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number",
          "description": "Numeric value"
        },
        "unit": {
          "type": "string",
          "description": "Unit of measure (e.g. \"sqft\", \"vehicles\", \"employees\")"
        },
        "system": {
          "type": "string",
          "description": "Code system URI for the unit.",
          "format": "uri"
        },
        "code": {
          "type": "string",
          "description": "Coded form of the unit"
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "description": "A quantity with a value and unit.",
      "examples": [
        {
          "value": 50000,
          "unit": "sqft"
        }
      ]
    },
    "Money": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number",
          "description": "Numeric amount. Represented as a number; precision should be maintained by the consuming system."
        },
        "currency": {
          "type": "string",
          "description": "ISO 4217 currency code.",
          "default": "USD"
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "description": "A monetary amount with currency.",
      "examples": [
        {
          "value": 1000000,
          "currency": "USD"
        }
      ]
    },
    "Period": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "description": "Start of the period (inclusive).",
          "format": "date"
        },
        "end": {
          "type": "string",
          "description": "End of the period (inclusive).",
          "format": "date"
        }
      },
      "additionalProperties": false,
      "description": "A time period defined by a start and/or end date. Used for policy terms, coverage periods, etc.",
      "examples": [
        {
          "start": "2025-01-01",
          "end": "2026-01-01"
        }
      ]
    },
    "AssetValuation": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Valuation method (replacement-cost, actual-cash-value, agreed-value, stated-value, market-value)."
        },
        "amount": {
          "$ref": "#/definitions/Money",
          "description": "The valuation amount"
        },
        "effectiveDate": {
          "type": "string",
          "description": "Date this valuation was effective or determined.",
          "format": "date"
        },
        "source": {
          "type": "string",
          "description": "Source of the valuation (appraisal, insured-stated, index-adjusted, market-comparable)"
        },
        "notes": {
          "type": "string",
          "description": "Notes about the valuation methodology or caveats"
        }
      },
      "required": [
        "type",
        "amount"
      ],
      "additionalProperties": false,
      "description": "A financial valuation of a risk or location asset. Captures different valuation methods (replacement cost, ACV, agreed value, etc.) and their provenance.",
      "examples": [
        {
          "type": {
            "coding": [
              {
                "code": "replacement-cost",
                "display": "Replacement Cost"
              }
            ]
          },
          "amount": {
            "value": 5000000,
            "currency": "USD"
          },
          "effectiveDate": "2025-01-15",
          "source": "appraisal"
        }
      ]
    },
    "NamedDriver": {
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/definitions/HumanName",
          "description": "The driver's name"
        },
        "dateOfBirth": {
          "type": "string",
          "description": "The driver's date of birth.",
          "format": "date"
        },
        "gender": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The driver's gender."
        },
        "licenseNumber": {
          "type": "string",
          "description": "Driver's license number"
        },
        "licenseState": {
          "type": "string",
          "description": "Two-letter state code where the license was issued"
        },
        "licenseStatus": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Current status of the driver's license."
        },
        "dateFirstLicensed": {
          "type": "string",
          "description": "Date the driver was first licensed.",
          "format": "date"
        },
        "driverStatus": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "How this driver is rated on the policy."
        },
        "relationshipToInsured": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Relationship of this driver to the named insured (spouse, child, household-member, employee)."
        },
        "primaryUse": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Primary use of the vehicle by this driver."
        },
        "annualMileage": {
          "type": "number",
          "description": "Estimated annual mileage driven.",
          "minimum": 0
        },
        "violations": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DrivingViolation"
          },
          "description": "Driving violations and incidents on this driver's record"
        },
        "defensiveDrivingCourse": {
          "type": "boolean",
          "description": "Whether the driver has completed a defensive driving course"
        },
        "goodStudentDiscount": {
          "type": "boolean",
          "description": "Whether the driver qualifies for a good student discount"
        },
        "person": {
          "$ref": "#/definitions/Reference",
          "description": "Optional reference to a Person resource for this driver"
        },
        "sr22Required": {
          "type": "boolean",
          "description": "Whether an SR-22 filing is required for this driver"
        }
      },
      "required": [
        "name",
        "driverStatus"
      ],
      "additionalProperties": false,
      "description": "A named driver on a personal auto policy. Structured type because drivers have enough fields to warrant dedicated modeling beyond generic RiskCharacteristics.",
      "examples": [
        {
          "name": {
            "family": "Smith",
            "given": [
              "John"
            ]
          },
          "dateOfBirth": "1985-03-15",
          "licenseNumber": "D123-4567-8901",
          "licenseState": "CA",
          "licenseStatus": "valid",
          "driverStatus": "rated",
          "primaryUse": "commute",
          "annualMileage": 12000
        }
      ]
    },
    "HumanName": {
      "type": "object",
      "properties": {
        "use": {
          "type": "string",
          "enum": [
            "official",
            "usual",
            "nickname",
            "maiden",
            "old",
            "anonymous"
          ],
          "description": "Context in which this name is used"
        },
        "text": {
          "type": "string",
          "description": "Full text representation of the name (e.g., \"John A. Smith, CPCU\")"
        },
        "family": {
          "type": "string",
          "description": "Surname / family name"
        },
        "given": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Given names (first name, middle names)"
        },
        "prefix": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Name prefixes (Mr., Dr., etc.)"
        },
        "suffix": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Name suffixes and professional designations (Jr., CPCU, ARM, CIC)"
        },
        "period": {
          "$ref": "#/definitions/Period",
          "description": "Period during which this name was/is in use"
        }
      },
      "additionalProperties": false,
      "description": "A human name with structured components. Adapted for insurance industry use (e.g., professional designations like CPCU, ARM, CIC).",
      "examples": [
        {
          "use": "official",
          "text": "John A. Smith, CPCU",
          "family": "Smith",
          "given": [
            "John",
            "Andrew"
          ],
          "suffix": [
            "CPCU"
          ]
        }
      ]
    },
    "DrivingViolation": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Type of violation (speeding, DUI, at-fault-accident, etc.)"
        },
        "date": {
          "type": "string",
          "description": "Date the violation occurred.",
          "format": "date"
        },
        "points": {
          "type": "number",
          "description": "Number of points assessed"
        },
        "atFault": {
          "type": "boolean",
          "description": "Whether the driver was at fault"
        },
        "description": {
          "type": "string",
          "description": "Free-text description of the violation"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "A driving violation or incident on a driver's record.",
      "examples": [
        {
          "type": {
            "text": "Speeding"
          },
          "date": "2024-06-15",
          "points": 2,
          "atFault": false
        }
      ]
    },
    "Lienholder": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the lienholder or mortgagee"
        },
        "type": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Type of financial interest."
        },
        "loanNumber": {
          "type": "string",
          "description": "Loan or mortgage number"
        },
        "address": {
          "$ref": "#/definitions/Address",
          "description": "Mailing address for the lienholder"
        },
        "contact": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ContactPoint"
          },
          "description": "Contact information for the lienholder"
        },
        "isaoa": {
          "type": "boolean",
          "description": "Whether the ISAOA/ATIMA (Its Successors and/or Assigns as Their Interests May Appear) clause applies"
        }
      },
      "required": [
        "name",
        "type"
      ],
      "additionalProperties": false,
      "description": "A party with a financial interest in an insured asset. Shared by both auto (vehicle lienholders) and home (mortgagees). Attached to Risk and Location resources.",
      "examples": [
        {
          "name": "First National Bank",
          "type": "mortgagee",
          "loanNumber": "MORT-2024-56789",
          "address": {
            "line": [
              "PO Box 12345"
            ],
            "city": "Charlotte",
            "state": "NC",
            "postalCode": "28201"
          },
          "isaoa": true
        }
      ]
    },
    "Address": {
      "type": "object",
      "properties": {
        "use": {
          "type": "string",
          "enum": [
            "work",
            "mailing",
            "billing",
            "loss-location",
            "home",
            "old"
          ],
          "description": "Purpose of this address"
        },
        "type": {
          "type": "string",
          "enum": [
            "postal",
            "physical",
            "both"
          ],
          "description": "The type of address (postal, physical, or both)"
        },
        "text": {
          "type": "string",
          "description": "Full unstructured text representation of the address"
        },
        "line": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Street address lines"
        },
        "city": {
          "type": "string",
          "description": "City or municipality"
        },
        "district": {
          "type": "string",
          "description": "County or district. Critical for insurance rating territories and jurisdiction determination."
        },
        "state": {
          "type": "string",
          "description": "State, province, or region"
        },
        "postalCode": {
          "type": "string",
          "description": "Postal / ZIP code"
        },
        "country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 country code.",
          "default": "US"
        },
        "period": {
          "$ref": "#/definitions/Period",
          "description": "Period during which this address was/is in use"
        },
        "geoPoint": {
          "$ref": "#/definitions/GeoPoint",
          "description": "Geographic coordinates of this address"
        }
      },
      "additionalProperties": false,
      "description": "A physical or mailing address.",
      "examples": [
        {
          "use": "work",
          "type": "both",
          "line": [
            "123 Main St",
            "Suite 400"
          ],
          "city": "Hartford",
          "state": "CT",
          "postalCode": "06103",
          "country": "US",
          "district": "Hartford County"
        }
      ]
    },
    "GeoPoint": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "description": "Latitude in decimal degrees.",
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": "number",
          "description": "Longitude in decimal degrees.",
          "minimum": -180,
          "maximum": 180
        },
        "altitude": {
          "type": "number",
          "description": "Altitude in meters above sea level"
        }
      },
      "required": [
        "latitude",
        "longitude"
      ],
      "additionalProperties": false,
      "description": "A geographic point in WGS84 coordinates. Used for precise location of insured properties, loss locations, etc."
    },
    "ContactPoint": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string",
          "enum": [
            "phone",
            "fax",
            "email",
            "url"
          ],
          "description": "The type of contact point"
        },
        "value": {
          "type": "string",
          "description": "The actual contact value (phone number, email address, etc.)"
        },
        "use": {
          "type": "string",
          "enum": [
            "work",
            "home",
            "mobile"
          ],
          "description": "Purpose of this contact point"
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "description": "Contact information for a person or organization."
    }
  },
  "$id": "https://bind-standard.org/schema/Risk",
  "title": "Risk"
}
