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