{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/nextgen-healthcare/main/json-schema/nextgen-healthcare-coverage-bundled-schema.json",
  "title": "CoverageBundled",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nextgen-healthcare-coverage-api-openapi.yml#/components/schemas/CoverageBundled",
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "meta": {
      "type": "object",
      "properties": {
        "lastUpdated": {
          "type": "string",
          "description": "Date in format - YYYY-MM-DDThh:mm:ss+zz"
        }
      }
    },
    "type": {
      "type": "string",
      "description": "Type of search"
    },
    "total": {
      "type": "integer",
      "description": "Number of Coverage records in entry"
    },
    "link": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "relation": {
            "type": "string",
            "minLength": 1,
            "description": "Relation to the resource"
          },
          "url": {
            "type": "string",
            "minLength": 1,
            "description": "FHIR URI of the request"
          }
        },
        "required": [
          "relation",
          "url"
        ]
      }
    },
    "entry": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fullUrl": {
            "type": "string",
            "minLength": 1,
            "description": "FHIR URI of the respective Coverage resource"
          },
          "resource": {
            "$ref": "#/$defs/Coverage"
          }
        }
      }
    }
  },
  "required": [
    "resourceType",
    "id",
    "meta",
    "type",
    "link"
  ],
  "$defs": {
    "Coverage": {
      "type": "object",
      "properties": {
        "resourceType": {
          "type": "string"
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "description": "ID of the resource"
        },
        "meta": {
          "type": "object",
          "description": "Metadata about the resource",
          "properties": {
            "profile": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "profile"
          ]
        },
        "identifier": {
          "type": "array",
          "description": "Business identifier for the coverage",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "object",
                "properties": {
                  "coding": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "system": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "value": {
                "type": "string"
              }
            }
          }
        },
        "status": {
          "type": "string",
          "description": "Status of the coverage (e.g., active)"
        },
        "type": {
          "type": "object",
          "description": "Type of coverage (e.g., PPO, HMO)",
          "properties": {
            "coding": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "display": {
                    "type": "string"
                  }
                }
              }
            },
            "text": {
              "type": "string"
            }
          }
        },
        "subscriberId": {
          "type": "string",
          "description": "Identifier of the subscriber"
        },
        "beneficiary": {
          "type": "object",
          "description": "Patient covered by the policy",
          "properties": {
            "reference": {
              "type": "string"
            }
          }
        },
        "relationship": {
          "type": "object",
          "description": "Relationship of beneficiary to subscriber",
          "properties": {
            "coding": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                }
              }
            },
            "text": {
              "type": "string"
            }
          }
        },
        "payor": {
          "type": "array",
          "description": "Payor responsible for the coverage",
          "items": {
            "type": "object",
            "properties": {
              "reference": {
                "type": "string"
              }
            }
          }
        },
        "class": {
          "type": "array",
          "description": "Plan or group classification",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "object",
                "properties": {
                  "coding": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "system": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "value": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          }
        },
        "period": {
          "type": "object",
          "description": "Coverage period",
          "properties": {
            "start": {
              "type": "string"
            },
            "end": {
              "type": "string"
            }
          }
        }
      },
      "required": [
        "resourceType",
        "id",
        "meta",
        "beneficiary",
        "payor"
      ]
    }
  }
}