{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/findadoctor-si/json-schema/findadoctor-si-gp-result-schema.json",
  "title": "GpResult",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/findadoctor-si-nz-openapi.json#/components/schemas/GpResult",
  "type": "object",
  "properties": {
    "provider": {
      "$ref": "#/$defs/Provider"
    },
    "total_matches": {
      "type": "integer"
    },
    "offset": {
      "type": "integer"
    },
    "enrolling_counts": {
      "type": "object",
      "description": "matches by enrolling status"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GpPractice"
      }
    },
    "explain": {
      "type": "string"
    },
    "next_step": {
      "type": "string"
    },
    "note": {
      "type": "string"
    }
  },
  "$defs": {
    "FeeRow": {
      "type": "object",
      "properties": {
        "ages": {
          "type": "string"
        },
        "without_csc": {
          "type": "string"
        },
        "with_csc": {
          "type": "string",
          "description": "Community Services Card holders"
        }
      },
      "description": "one row of the practice's fee table (usually fees for enrolled patients)"
    },
    "GpPractice": {
      "type": "object",
      "properties": {
        "rank": {
          "type": "integer"
        },
        "practice": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "general practice",
            "urgent care"
          ]
        },
        "enrolling": {
          "type": "string",
          "enum": [
            "yes",
            "restricted",
            "no",
            "does not apply",
            "unknown"
          ],
          "description": "yes, restricted (only some people), no, does not apply (urgent care), unknown"
        },
        "enrolling_note": {
          "type": "string",
          "description": "the practice's own words about enrolment"
        },
        "place_match": {
          "type": "string",
          "enum": [
            "city_or_address",
            "city_in_region",
            "address_contains",
            "region_page_only"
          ]
        },
        "locations": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "website": {
                "type": "string"
              }
            }
          }
        },
        "fees": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeeRow"
          }
        },
        "fee_for_age": {
          "type": "object",
          "description": "with age: the fee row for that age"
        },
        "online_booking": {
          "type": "string"
        },
        "website": {
          "type": "string"
        },
        "hours": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "languages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "languages_note": {
          "type": "string"
        },
        "doctors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "doctor_id": {
                "type": "string",
                "pattern": "^nz_[0-9a-z]{12}$",
                "description": "use with get_doctor"
              },
              "name": {
                "type": "string"
              }
            }
          }
        },
        "doctors_listed": {
          "type": "integer"
        },
        "healthpoint": {
          "type": "string",
          "description": "the practice's Healthpoint page"
        },
        "page_last_updated": {
          "type": "string"
        }
      }
    },
    "Provider": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "data_version": {
          "type": "string"
        }
      },
      "description": "who publishes this data and which build"
    }
  }
}