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