{
  "openapi": "3.1.0",
  "info": {
    "title": "pICVP API",
    "description": "Data elements for the Paper Model International Certificate of Vaccination or Prophylaxis.",
    "version": "1.0.0"
  },
  "paths": {
    "/StructureDefinition-pICVP.schema.json": {
      "get": {
        "summary": "JSON Schema definition for the Logical Model StructureDefinition-pICVP",
        "description": "This endpoint serves the JSON Schema definition for the Logical Model StructureDefinition-pICVP.",
        "responses": {
          "200": {
            "description": "The JSON Schema for StructureDefinition-pICVP",
            "content": {
              "application/schema+json": {
                "schema": {
                  "$ref": "./StructureDefinition-pICVP.schema.json"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StructureDefinition-pICVP": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "http://smart.who.int/base/StructureDefinition-pICVP.schema.json",
        "title": "pICVP",
        "description": "Data elements for the Paper Model International Certificate of Vaccination or Prophylaxis.",
        "type": "object",
        "properties": {
          "resourceType": {
            "type": "string",
            "const": "pICVP",
            "description": "Resource type identifier for pICVP logical model"
          },
          "@context": {
            "description": "JSON-LD context for this logical model with ValueSet vocabularies",
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "URI reference to external JSON-LD context"
              },
              {
                "type": "object",
                "description": "Inline JSON-LD context",
                "properties": {
                  "@version": {
                    "type": "number",
                    "const": 1.1
                  },
                  "fhir": {
                    "type": "string",
                    "const": "http://hl7.org/fhir/"
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "uri"
                }
              },
              {
                "type": "array",
                "description": "Array of JSON-LD context objects/URIs",
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uri"
                    },
                    {
                      "type": "object"
                    }
                  ]
                }
              }
            ]
          },
          "@type": {
            "type": "string",
            "description": "JSON-LD type identifier for pICVP logical model",
            "examples": [
              "LogicalModel-pICVP"
            ]
          },
          "name": {
            "type": "string",
            "description": "Name of the recipient of vaccine or prophylaxis"
          },
          "dob": {
            "type": "string",
            "format": "date",
            "description": "Date of Birth"
          },
          "sex": {
            "$ref": "./ValueSet-administrative-gender.schema.json",
            "description": "Sex"
          },
          "nationality": {
            "$ref": "./ValueSet-iso3166-1-3.schema.json",
            "description": "Nationality"
          },
          "nid": {
            "type": "object",
            "description": "National Identification Document, if applicable"
          },
          "id": {
            "type": "object",
            "description": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces."
          },
          "use": {
            "$ref": "./ValueSet-identifier-use|5.0.0.schema.json",
            "description": "The purpose of this identifier."
          },
          "type": {
            "$ref": "./ValueSet-identifier-type|5.0.0.schema.json",
            "description": "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose."
          },
          "system": {
            "type": "string",
            "format": "uri",
            "description": "Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique."
          },
          "value": {
            "type": "string",
            "description": "The portion of the identifier typically relevant to the user and which is unique within the context of the system."
          },
          "period": {
            "type": "object",
            "description": "Time period during which identifier is/was valid for use."
          },
          "assigner": {
            "type": "object",
            "description": "Organization that issued/manages the identifier."
          },
          "guardian": {
            "type": "string",
            "description": "Name of the parent or guardian. Required where applicable, as defined by the State Party (example: when the recipient is a minor or dependent)"
          },
          "disease": {
            "type": "array",
            "items": {
              "$ref": "./ValueSet-mms.schema.json",
              "description": "Coding-shaped {system, code} object from ValueSet mms"
            },
            "minItems": 1,
            "description": "Name of disease or condition"
          },
          "integrityCheck": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "FHIR BackboneElement"
            },
            "description": "Integrity check value"
          },
          "modifierExtension": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "FHIR Extension"
            },
            "description": "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself)."
          },
          "cryptographicSignature": {
            "type": "string",
            "description": "Cryptographic signature of the issuer"
          },
          "kid": {
            "type": "string",
            "description": "Key identifier for signature verification"
          },
          "vaccineDetails": {
            "type": "array",
            "items": {
              "$ref": "StructureDefinition-ICVPVaccineDetails.schema.json"
            },
            "minItems": 1,
            "description": "Vaccine Details"
          },
          "version": {
            "type": "string",
            "description": "Version of the certificate template"
          }
        },
        "required": [
          "resourceType",
          "name",
          "dob",
          "sex",
          "nationality",
          "nid",
          "disease",
          "cryptographicSignature",
          "kid",
          "vaccineDetails",
          "version"
        ],
        "allOf": [
          {
            "$ref": "./StructureDefinition-FHIRSchemaBase.schema.json"
          },
          {
            "type": "object",
            "properties": {
              "resourceDefinition": {
                "type": "string",
                "format": "uri",
                "const": "http://smart.who.int/icvp/StructureDefinition/pICVP"
              },
              "fhir:parent": {
                "type": "string",
                "const": "http://smart.who.int/icvp/StructureDefinition/ICVP"
              },
              "jsonld:valuesets": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "const": [
                  "administrative-gender",
                  "identifier-type|5.0.0",
                  "identifier-use|5.0.0",
                  "iso3166-1-3",
                  "mms",
                  "v2-0203|3.0.0"
                ]
              },
              "jsonld:contextTemplate": {
                "type": "object",
                "const": {
                  "@version": 1.1,
                  "fhir": "http://hl7.org/fhir/",
                  "mms": "http://smart.who.int/base/ValueSet-mms.jsonld",
                  "iso3166-1-3": "http://smart.who.int/base/ValueSet-iso3166-1-3.jsonld",
                  "v2-0203|3.0.0": "http://smart.who.int/base/ValueSet-v2-0203|3.0.0.jsonld",
                  "identifier-use|5.0.0": "http://smart.who.int/base/ValueSet-identifier-use|5.0.0.jsonld",
                  "identifier-type|5.0.0": "http://smart.who.int/base/ValueSet-identifier-type|5.0.0.jsonld",
                  "administrative-gender": "http://smart.who.int/base/ValueSet-administrative-gender.jsonld"
                }
              }
            }
          }
        ]
      }
    }
  }
}