{
  "swagger": "2.0",
  "info": {
    "contact": {
      "email": "info@ehealth.fgov.be",
      "name": "eHealth Platform Belgium"
    },
    "title": "API eHealth Therapeutic Exclusion",
    "version": "v2.1"
  },
  "host": "api.ehealth.fgov.be",
  "basePath": "/therapeuticExclusion/v2",
  "schemes": [
    "https"
  ],
  "paths": {
    "/health": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Service is UP",
            "schema": {
              "$ref": "#/definitions/HealthStatus"
            }
          },
          "403": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "503": {
            "description": "The service is DOWN or OUT_OF_SERVICE",
            "examples": {
              "application/json": {
                "details": {
                  "datastore": {
                    "status": "OUT_OF_SERVICE"
                  }
                },
                "status": "DOWN"
              }
            },
            "schema": {
              "$ref": "#/definitions/HealthStatus"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "monitoring"
            ]
          }
        ],
        "tags": [
          "monitoring exclusion"
        ],
        "description": "Get the monitoring status of the service exclusion",
        "operationId": "getMonitoringInfo"
      }
    },
    "/histories/{patientSsin}": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN)",
            "in": "path",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "limit of history entries",
            "in": "query",
            "name": "pageSize",
            "type": "integer"
          }
        ],
        "responses": {
          "200": {
            "description": "The exclusion history is found",
            "schema": {
              "items": {
                "$ref": "#/definitions/historyEntry"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "No therapeutic exclusion found between the patient and the specified healthcare party",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "rest-access"
            ]
          }
        ],
        "tags": [
          "therapeutic exclusion"
        ],
        "description": "Gets the therapeutic exclusion history",
        "operationId": "getTherapeuticExclusionHistory"
      }
    },
    "/therapeuticExclusions": {
      "delete": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN)",
            "in": "query",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "Id of the healthcare party (SSIN)",
            "in": "query",
            "name": "hcPartySsin",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party (NIHII)",
            "in": "query",
            "name": "hcPartyNihii",
            "type": "string"
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "No therapeutic exclusion found between the patient and the specified healthcare party",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "rest-access"
            ]
          }
        ],
        "tags": [
          "therapeutic exclusion"
        ],
        "description": "Revokes a therapeutic exclusion. The hcPartySsin is required of professionals, the hcPartyNihii is required for organizations like pharmacies.",
        "operationId": "deleteTherapeuticExclusion"
      },
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Therapeutic exclusion data",
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/therapeuticExclusion"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "409": {
            "description": "Therapeutic exclusion already exists",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "rest-access"
            ]
          }
        ],
        "tags": [
          "therapeutic exclusion"
        ],
        "description": "\"Creates a therapeutic exclusion.\n\nFor the GET and the DELETE, there's no validations except for the id's checksum.\nFor the POST, the exclusion object is validated as following:\n* For the patient, the id is mandatory and the firstName/lastName are ignored as they are derived from the authentication token.\n* For the target HcParty:\n** The firstName and name are ignored because they are obtained from the authentic source.\n** The type is validated against the hcParty identifier (inss or nihii).\n** For professionals, the inss is mandatory, the nihii is optional and informative only as exclusion target physical persons, it's format is validated, but if entered it will be stored and returned in a get, otherwise it will be ignored.\n** For organizations, the inss is forbidden, the nihii is mandatory.\n** Note that the nihii is never crosschecked with the inss\"\n",
        "operationId": "createTherapeuticExclusion",
        "x-codegen-request-body-name": "therapeuticExclusion"
      }
    },
    "/therapeuticExclusions/{patientSsin}": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN). If no other param defined, retrieve all exclusions from the patient.",
            "in": "path",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "Id of the healthcare party (SSIN), will retrieve professionals",
            "in": "query",
            "name": "hcPartySsin",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party (NIHII), will retrieve organizations like pharmacies, do not use for professionals",
            "in": "query",
            "name": "hcPartyNihii",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "items": {
                "$ref": "#/definitions/therapeuticExclusion"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "No therapeutic exclusion found between the patient and the specified healthcare party",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "rest-access"
            ]
          }
        ],
        "tags": [
          "therapeutic exclusion"
        ],
        "description": "Gets a therapeutic exclusion",
        "operationId": "getTherapeuticExclusion"
      }
    }
  },
  "definitions": {
    "ComponentStatus": {
      "example": {
        "name": "name",
        "status": "status"
      },
      "properties": {
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "HealthLevel": {
      "type": "string"
    },
    "HealthStatus": {
      "example": {
        "details": [
          {
            "name": "name",
            "status": "status"
          },
          {
            "name": "name",
            "status": "status"
          }
        ],
        "status": "status"
      },
      "properties": {
        "details": {
          "items": {
            "$ref": "#/definitions/ComponentStatus"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "actor": {
      "example": {
        "firstName": "firstName",
        "identifier": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ],
        "name": "name",
        "qualificationCode": "qualificationCode"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "identifier": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        },
        "name": {
          "type": "string"
        },
        "qualificationCode": {
          "type": "string"
        }
      },
      "required": [
        "identifier"
      ],
      "type": "object"
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "hcParty": {
      "example": {
        "firstName": "firstName",
        "identifier": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ],
        "name": "name",
        "qualificationCode": "qualificationCode"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "identifier": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        },
        "name": {
          "type": "string"
        },
        "qualificationCode": {
          "type": "string"
        }
      },
      "required": [
        "identifier",
        "qualificationCode"
      ],
      "type": "object"
    },
    "historyEntry": {
      "example": {
        "author": [
          {
            "firstName": "firstName",
            "identifier": [
              {
                "type": "type",
                "value": "value"
              },
              {
                "type": "type",
                "value": "value"
              }
            ],
            "name": "name",
            "qualificationCode": "qualificationCode"
          },
          {
            "firstName": "firstName",
            "identifier": [
              {
                "type": "type",
                "value": "value"
              },
              {
                "type": "type",
                "value": "value"
              }
            ],
            "name": "name",
            "qualificationCode": "qualificationCode"
          }
        ],
        "operation": "operation",
        "target": {
          "firstName": "firstName",
          "identifier": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name",
          "qualificationCode": "qualificationCode"
        },
        "timestamp": "2000-01-23T04:56:07.000+00:00"
      },
      "properties": {
        "author": {
          "items": {
            "$ref": "#/definitions/actor"
          },
          "type": "array"
        },
        "operation": {
          "type": "string"
        },
        "target": {
          "$ref": "#/definitions/hcParty"
        },
        "timestamp": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "author",
        "operation",
        "target",
        "timestamp"
      ],
      "type": "object"
    },
    "identifier": {
      "example": {
        "type": "type",
        "value": "value"
      },
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "patient": {
      "example": {
        "identifier": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ]
      },
      "properties": {
        "identifier": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        }
      },
      "required": [
        "identifier"
      ],
      "type": "object"
    },
    "therapeuticExclusion": {
      "example": {
        "hcParty": {
          "firstName": "firstName",
          "identifier": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name",
          "qualificationCode": "qualificationCode"
        },
        "patient": {
          "identifier": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ]
        }
      },
      "properties": {
        "hcParty": {
          "$ref": "#/definitions/hcParty"
        },
        "patient": {
          "$ref": "#/definitions/patient"
        }
      },
      "required": [
        "patient"
      ],
      "type": "object"
    }
  },
  "securityDefinitions": {
    "OAuth2": {
      "authorizationUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/auth",
      "flow": "accessCode",
      "scopes": {
        "monitoring": "This is a workaround, don't use me",
        "rest-access": "Allows all operations on Exclusion service"
      },
      "tokenUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/token",
      "type": "oauth2"
    }
  },
  "x-components": {}
}
