﻿{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/Location",
  "$ref": "#/definitions/Location",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "Location": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json/definitions/DomainResource"
        },
        {
          "description": "Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.",
          "properties": {
            "resourceType": {
              "description": "This is a Location resource",
              "type": "string",
              "enum": [
                "Location"
              ]
            },
            "identifier": {
              "description": "Unique code or number identifying the location to its users.",
              "type": "array",
              "items": {
                "$ref": "Identifier.schema.json/definitions/Identifier"
              }
            },
            "status": {
              "description": "active | suspended | inactive.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "name": {
              "description": "Name of the location as used by humans. Does not need to be unique.",
              "type": "string"
            },
            "name_": {
              "description": "Extensions for name",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "alias": {
              "description": "A list of alternate names that the location is known as, or was known as in the past.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "alias_": {
              "description": "Extensions for alias",
              "items": {
                "$ref": "Element.schema.json/definitions/Element"
              }
            },
            "description": {
              "description": "Description of the Location, which helps in finding or referencing the place.",
              "type": "string"
            },
            "description_": {
              "description": "Extensions for description",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "mode": {
              "description": "Indicates whether a resource instance represents a specific location or a class of locations.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "mode_": {
              "description": "Extensions for mode",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "type": {
              "description": "Indicates the type of function performed at the location.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "telecom": {
              "description": "The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.",
              "type": "array",
              "items": {
                "$ref": "ContactPoint.schema.json/definitions/ContactPoint"
              }
            },
            "address": {
              "description": "Physical location.",
              "$ref": "Address.schema.json/definitions/Address"
            },
            "physicalType": {
              "description": "Physical form of the location, e.g. building, room, vehicle, road.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "position": {
              "description": "The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).",
              "$ref": "#/definitions/Location.Position"
            },
            "managingOrganization": {
              "description": "The organization responsible for the provisioning and upkeep of the location.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "partOf": {
              "description": "Another Location which this Location is physically part of.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "endpoint": {
              "description": "Technical endpoints providing access to services operated for the location.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            }
          },
          "required": [
            "resourceType"
          ]
        }
      ]
    },
    "Location.Position": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.",
          "properties": {
            "longitude": {
              "description": "Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "longitude_": {
              "description": "Extensions for longitude",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "latitude": {
              "description": "Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "latitude_": {
              "description": "Extensions for latitude",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "altitude": {
              "description": "Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "altitude_": {
              "description": "Extensions for altitude",
              "$ref": "Element.schema.json/definitions/Element"
            }
          }
        }
      ]
    }
  }
}