{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/PersonRole",
  "definitions": {
    "PersonRole": {
      "type": "object",
      "properties": {
        "resourceType": {
          "type": "string",
          "const": "PersonRole",
          "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",
            "on-leave"
          ],
          "description": "Whether this role assignment is currently active"
        },
        "person": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the person fulfilling this role"
        },
        "organization": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the organization the person works for/with"
        },
        "role": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "The role the person plays (underwriter, broker, producer, adjuster, actuary, etc.)"
        },
        "specialty": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CodeableConcept"
          },
          "description": "Lines of business or areas of specialization."
        },
        "period": {
          "$ref": "#/definitions/Period",
          "description": "Period during which this role assignment is/was effective"
        },
        "contact": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ContactPoint"
          },
          "description": "Role-specific contact information (may differ from Person.contact)"
        },
        "bindingAuthority": {
          "type": "object",
          "properties": {
            "maxPremium": {
              "$ref": "#/definitions/Money",
              "description": "Maximum premium amount this person can bind"
            },
            "maxLimit": {
              "$ref": "#/definitions/Money",
              "description": "Maximum limit of insurance this person can bind"
            },
            "linesOfBusiness": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/CodeableConcept"
              },
              "description": "Lines of business this person can bind."
            },
            "territory": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Geographic territories this person can bind"
            }
          },
          "additionalProperties": false,
          "description": "Binding authority granted under this role"
        },
        "reportsTo": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the person this role reports to (PersonRole reference)"
        },
        "producerType": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Subtype of producer role for distribution channel tracking."
        }
      },
      "required": [
        "organization",
        "person",
        "resourceType",
        "role",
        "status"
      ],
      "additionalProperties": false,
      "description": "The role a Person plays within an Organization. Handles relationships like \"Sarah is an underwriter at Hartford for commercial property.\" Includes binding authority and reporting structure.",
      "examples": [
        {
          "resourceType": "PersonRole",
          "id": "pr-001",
          "status": "active",
          "person": {
            "reference": "Person/per-001",
            "display": "Sarah Chen"
          },
          "organization": {
            "reference": "Organization/carrier-200",
            "display": "Hartford"
          },
          "role": {
            "coding": [
              {
                "code": "underwriter",
                "display": "Underwriter"
              }
            ]
          },
          "specialty": [
            {
              "coding": [
                {
                  "code": "commercial-property",
                  "display": "Commercial Property"
                }
              ]
            }
          ],
          "bindingAuthority": {
            "maxPremium": {
              "value": 500000,
              "currency": "USD"
            },
            "maxLimit": {
              "value": 10000000,
              "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"
        }
      ]
    },
    "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"
        }
      ]
    },
    "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."
    },
    "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"
        }
      ]
    },
    "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."
    },
    "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"
        }
      ]
    }
  },
  "$id": "https://bind-standard.org/schema/PersonRole",
  "title": "PersonRole"
}
