{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/propagator-health/json-schema/propagator-health-funding-schema.json",
  "title": "Funding",
  "description": "Patient funding/coverage record. Models insurance policies, NDIS plans, third-party payer\nagreements and similar. Sourced from Cliniko PatientCase, Halaxy FHIR Coverage or Nookal case payer.\n",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/propagator-health-openapi.json#/components/schemas/Funding",
  "type": "object",
  "required": [
    "id",
    "patientId",
    "status",
    "validity"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable funding identifier. Equal to the vendor primary key for Cliniko and Halaxy.\nFor Nookal it is composite as `caseID:thirdPartyID` (or `caseID:none` when the case has\nno payer), so a single Nookal case with multiple payers expands to multiple Funding rows.\n"
    },
    "patientId": {
      "type": "string",
      "description": "Subject patient ID in the PMS namespace"
    },
    "label": {
      "type": [
        "string",
        "null"
      ],
      "description": "Human-readable description of the funding (e.g. case name, plan name, payer)"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "unknown"
      ],
      "description": "Normalised lifecycle status"
    },
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "Funding type passed through from the source. Common values: ndis, medicare, workcover, dva, private, third_party"
    },
    "payer": {
      "type": [
        "object",
        "null"
      ],
      "description": "The party responsible for paying. Null when the source does not expose a payer.",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Native payer identifier where available"
        },
        "displayName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display name of the payer"
        },
        "reference": {
          "type": [
            "string",
            "null"
          ],
          "description": "Membership/policy/claim reference number where available"
        }
      }
    },
    "validity": {
      "type": "object",
      "required": [
        "effectiveFrom",
        "effectiveTo"
      ],
      "properties": {
        "effectiveFrom": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Start of validity (ISO date)"
        },
        "effectiveTo": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "End of validity (ISO date)"
        }
      }
    },
    "entitlement": {
      "type": [
        "object",
        "null"
      ],
      "description": "Session/budget entitlement. Populated for Cliniko (when `?include=usage` is set) and\nNookal. Always null for Halaxy because FHIR Coverage does not model entitlement balances.\n",
      "properties": {
        "approvedSessions": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Total sessions approved under this funding"
        },
        "usedSessions": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Sessions used to date"
        },
        "remainingSessions": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Sessions remaining (live for Nookal; derived for Cliniko)"
        },
        "approvedAmount": {
          "type": [
            "number",
            "null"
          ],
          "description": "Total approved monetary amount"
        },
        "currency": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 4217 currency code where available"
        }
      }
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Free-text notes from the source record"
    }
  }
}