{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/VisionPrescription",
  "$ref": "#/definitions/VisionPrescription",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "VisionPrescription": {
      "allOf": [
        {
          "$ref": "DomainResource#/definitions/DomainResource"
        },
        {
          "description": "An authorization for the supply of glasses and/or contact lenses to a patient.",
          "properties": {
            "resourceType": {
              "description": "This is a VisionPrescription resource",
              "type": "string",
              "enum": [
                "VisionPrescription"
              ]
            },
            "identifier": {
              "description": "Business identifier which may be used by other parties to reference or identify the prescription.",
              "type": "array",
              "items": {
                "$ref": "Identifier.schema.json#/definitions/Identifier"
              }
            },
            "status": {
              "description": "The status of the resource instance.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "_status": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "patient": {
              "description": "A link to a resource representing the person to whom the vision products will be supplied.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "encounter": {
              "description": "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "dateWritten": {
              "description": "The date (and perhaps time) when the prescription was written.",
              "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)))?)?)?"
            },
            "_dateWritten": {
              "description": "Extensions for dateWritten",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "prescriber": {
              "description": "The healthcare professional responsible for authorizing the prescription.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "reasonCodeableConcept": {
              "description": "Can be the reason or the indication for writing the prescription.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "reasonReference": {
              "description": "Can be the reason or the indication for writing the prescription.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "dispense": {
              "description": "Deals with details of the dispense part of the supply specification.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/VisionPrescription_Dispense"
              }
            }
          },
          "required": [
            "resourceType"
          ]
        }
      ]
    },
    "VisionPrescription_Dispense": {
      "allOf": [
        {
          "$ref": "BackboneElement#/definitions/BackboneElement"
        },
        {
          "description": "An authorization for the supply of glasses and/or contact lenses to a patient.",
          "properties": {
            "product": {
              "description": "Identifies the type of vision correction product which is required for the patient.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "eye": {
              "description": "The eye for which the lens applies.",
              "enum": [
                "right",
                "left"
              ],
              "type": "string"
            },
            "_eye": {
              "description": "Extensions for eye",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "sphere": {
              "description": "Lens power measured in diopters (0.25 units).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_sphere": {
              "description": "Extensions for sphere",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "cylinder": {
              "description": "Power adjustment for astigmatism measured in diopters (0.25 units).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_cylinder": {
              "description": "Extensions for cylinder",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "axis": {
              "description": "Adjustment for astigmatism measured in integer degrees.",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))"
            },
            "_axis": {
              "description": "Extensions for axis",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "prism": {
              "description": "Amount of prism to compensate for eye alignment in fractional units.",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_prism": {
              "description": "Extensions for prism",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "base": {
              "description": "The relative base, or reference lens edge, for the prism.",
              "enum": [
                "up",
                "down",
                "in",
                "out"
              ],
              "type": "string"
            },
            "_base": {
              "description": "Extensions for base",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "add": {
              "description": "Power adjustment for multifocal lenses measured in diopters (0.25 units).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_add": {
              "description": "Extensions for add",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "power": {
              "description": "Contact lens power measured in diopters (0.25 units).",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_power": {
              "description": "Extensions for power",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "backCurve": {
              "description": "Back curvature measured in millimeters.",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_backCurve": {
              "description": "Extensions for backCurve",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "diameter": {
              "description": "Contact lens diameter measured in millimeters.",
              "type": "number",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?"
            },
            "_diameter": {
              "description": "Extensions for diameter",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "duration": {
              "description": "The recommended maximum wear period for the lens.",
              "$ref": "Quantity.schema.json#/definitions/Quantity"
            },
            "color": {
              "description": "Special color or pattern.",
              "type": "string"
            },
            "_color": {
              "description": "Extensions for color",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "brand": {
              "description": "Brand recommendations or restrictions.",
              "type": "string"
            },
            "_brand": {
              "description": "Extensions for brand",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "note": {
              "description": "Notes for special requirements such as coatings and lens materials.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json#/definitions/Annotation"
              }
            }
          }
        }
      ]
    }
  }
}