{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/Commission",
  "definitions": {
    "Commission": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Type of commission (standard, contingent, override, bonus, profit-sharing)."
        },
        "percentage": {
          "type": "number",
          "description": "Commission percentage"
        },
        "amount": {
          "$ref": "#/definitions/Money",
          "description": "Commission as a fixed dollar amount"
        },
        "payableTo": {
          "$ref": "#/definitions/Reference",
          "description": "Organization the commission is payable to (broker/agency)"
        },
        "producer": {
          "$ref": "#/definitions/Reference",
          "description": "Individual producer who earned the commission (PersonRole reference)"
        },
        "schedule": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "When commission is earned/payable."
        },
        "tiers": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CommissionTier"
          },
          "description": "Tiered commission schedule based on loss ratio"
        },
        "splits": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CommissionSplit"
          },
          "description": "Commission splits between multiple parties"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "A commission arrangement for a policy. Replaces the simple `commissionPercentage` field on Policy, supporting standard, contingent, override, and profit-sharing commissions with tiered structures and multi-party splits.",
      "examples": [
        {
          "type": {
            "text": "Standard"
          },
          "percentage": 15,
          "payableTo": {
            "reference": "Organization/broker-100",
            "display": "Marsh McLennan"
          },
          "schedule": "on-effective"
        }
      ]
    },
    "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"
        }
      ]
    },
    "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"
        }
      ]
    },
    "CommissionTier": {
      "type": "object",
      "properties": {
        "lossRatioFrom": {
          "type": "number",
          "description": "Lower bound of the loss ratio range (inclusive)"
        },
        "lossRatioTo": {
          "type": "number",
          "description": "Upper bound of the loss ratio range (exclusive)"
        },
        "percentage": {
          "type": "number",
          "description": "Commission percentage for this tier"
        }
      },
      "required": [
        "percentage"
      ],
      "additionalProperties": false,
      "description": "A tier in a sliding-scale commission arrangement. Commission percentage varies based on loss ratio performance."
    },
    "CommissionSplit": {
      "type": "object",
      "properties": {
        "party": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the party receiving this split"
        },
        "percentage": {
          "type": "number",
          "description": "Percentage of the total commission allocated to this party"
        },
        "amount": {
          "$ref": "#/definitions/Money",
          "description": "Dollar amount allocated to this party"
        },
        "role": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Role of this party in the split (e.g., house, producer, wholesaler)."
        }
      },
      "required": [
        "party",
        "percentage"
      ],
      "additionalProperties": false,
      "description": "A commission split between multiple parties. Used when commission is shared between wholesaler/retailer, house account/producer, or multiple producers."
    }
  },
  "$id": "https://bind-standard.org/schema/Commission",
  "title": "Commission"
}
