{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/CarrierAppointment",
  "definitions": {
    "CarrierAppointment": {
      "type": "object",
      "properties": {
        "carrier": {
          "$ref": "#/definitions/Reference",
          "description": "Reference to the carrier organization"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "inactive",
            "pending",
            "terminated"
          ],
          "description": "Current status of the appointment"
        },
        "linesOfBusiness": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CodeableConcept"
          },
          "description": "Lines of business authorized under this appointment."
        },
        "effectivePeriod": {
          "$ref": "#/definitions/Period",
          "description": "Period during which this appointment is/was effective"
        },
        "commissionType": {
          "$ref": "#/definitions/CodeableConcept",
          "description": "Type of commission arrangement under this appointment."
        }
      },
      "required": [
        "carrier",
        "status"
      ],
      "additionalProperties": false,
      "description": "An appointment between a broker/MGA and a carrier. Tracks which carriers an agency is authorized to write business with.",
      "examples": [
        {
          "carrier": {
            "reference": "Organization/carrier-200",
            "display": "Hartford"
          },
          "status": "active",
          "linesOfBusiness": [
            {
              "coding": [
                {
                  "code": "GL"
                }
              ]
            }
          ]
        }
      ]
    },
    "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."
    },
    "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"
        }
      ]
    },
    "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"
        }
      ]
    }
  },
  "$id": "https://bind-standard.org/schema/CarrierAppointment",
  "title": "CarrierAppointment"
}
