{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/CoverageLimit",
  "definitions": {
    "CoverageLimit": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The type of limit (Each Occurrence, Aggregate, Per Person, etc.)"
        },
        "amount": {
          "$ref": "#/definitions/Money",
          "description": "The limit amount (either amount or splitAmounts should be present)"
        },
        "splitAmounts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SplitLimitComponent"
          },
          "description": "Split limit components (e.g., auto liability 100/300/100)"
        },
        "shared": {
          "type": "boolean",
          "description": "Whether this limit is shared across multiple coverages"
        },
        "basisType": {
          "type": "string",
          "description": "Basis type for the limit (e.g., \"per occurrence\", \"per location\", \"per project\")"
        },
        "isSublimit": {
          "type": "boolean",
          "description": "Whether this is a sublimit of a broader coverage limit"
        },
        "parentLimit": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The parent limit this sublimit falls under"
        },
        "attachmentPoint": {
          "$ref": "#/definitions/Money",
          "description": "Attachment point for excess/umbrella layers"
        },
        "eroded": {
          "$ref": "#/definitions/Money",
          "description": "Amount of the limit that has been eroded by losses"
        },
        "remaining": {
          "$ref": "#/definitions/Money",
          "description": "Remaining limit after erosion"
        },
        "reinstatements": {
          "type": "number",
          "description": "Number of times the limit can be reinstated after a loss"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "A specific limit of insurance within a coverage. Commercial policies typically have multiple limit types (e.g., per-occurrence, aggregate, per-person).",
      "examples": [
        {
          "type": {
            "text": "Each Occurrence"
          },
          "amount": {
            "value": 1000000,
            "currency": "USD"
          }
        }
      ]
    },
    "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"
        }
      ]
    },
    "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"
        }
      ]
    },
    "SplitLimitComponent": {
      "type": "object",
      "properties": {
        "category": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The category of this split limit component (e.g., Per Person BI, Per Accident BI, PD)."
        },
        "amount": {
          "$ref": "#/definitions/Money",
          "description": "The limit amount for this component"
        }
      },
      "required": [
        "category",
        "amount"
      ],
      "additionalProperties": false,
      "description": "A component of a split limit structure. Used when a coverage has separate limits for different categories (e.g., auto liability split limits: 100/300/100)."
    }
  },
  "$id": "https://bind-standard.org/schema/CoverageLimit",
  "title": "CoverageLimit"
}
