﻿{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/SupplyRequest",
  "$ref": "#/definitions/SupplyRequest",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "SupplyRequest": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json/definitions/DomainResource"
        },
        {
          "description": "A record of a request for a medication, substance or device used in the healthcare setting.",
          "properties": {
            "resourceType": {
              "description": "This is a SupplyRequest resource",
              "type": "string",
              "enum": [
                "SupplyRequest"
              ]
            },
            "patient": {
              "description": "A link to a resource representing the person whom the ordered item is for.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "source": {
              "description": "The Practitioner , Organization or Patient who initiated this order for the supply.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "date": {
              "description": "When the request was made.",
              "type": "string",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"
            },
            "date_": {
              "description": "Extensions for date",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "identifier": {
              "description": "Unique identifier for this supply request.",
              "$ref": "Identifier.schema.json/definitions/Identifier"
            },
            "status": {
              "description": "Status of the supply request.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "kind": {
              "description": "Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "orderedItemCodeableConcept": {
              "description": "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "orderedItemReference": {
              "description": "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "supplier": {
              "description": "Who is intended to fulfill the request.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "reasonCodeableConcept": {
              "description": "Why the supply item was requested.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "reasonReference": {
              "description": "Why the supply item was requested.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "when": {
              "description": "When the request should be fulfilled.",
              "$ref": "#/definitions/SupplyRequest.When"
            }
          },
          "required": [
            "resourceType"
          ]
        }
      ]
    },
    "SupplyRequest.When": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "A record of a request for a medication, substance or device used in the healthcare setting.",
          "properties": {
            "code": {
              "description": "Code indicating when the request should be fulfilled.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "schedule": {
              "description": "Formal fulfillment schedule.",
              "$ref": "Timing.schema.json/definitions/Timing"
            }
          }
        }
      ]
    }
  }
}