{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/RiskCharacteristic",
  "definitions": {
    "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
        }
      ]
    },
    "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."
    },
    "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"
        }
      ]
    },
    "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"
        }
      ]
    }
  },
  "$id": "https://bind-standard.org/schema/RiskCharacteristic",
  "title": "RiskCharacteristic"
}
