{
  "swagger": "2.0",
  "info": {
    "contact": {
      "email": "info@ehealth.fgov.be",
      "name": "eHealth Platform Belgium"
    },
    "title": "API eHealth Therapeutic Link",
    "version": "v2.1"
  },
  "host": "api.ehealth.fgov.be",
  "basePath": "/therapeuticLink/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 Therapeutic Link"
        ],
        "description": "Get the monitoring status of the service Therapeutic Link",
        "operationId": "getMonitoringInfo"
      }
    },
    "/therapeuticLinks": {
      "delete": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN)",
            "in": "query",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "Support card id of the patient",
            "in": "query",
            "name": "patientCardNumber",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party (SSIN)",
            "in": "query",
            "name": "hcPartySsin",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party qualification (NIHDI)",
            "in": "query",
            "name": "hcPartyNihii",
            "type": "string"
          },
          {
            "description": "Qualification code of the healthcare party, also called quality. The values are the one from Khmer, like persphysician, orgpharmacy, ...",
            "in": "query",
            "name": "hcPartyQualificationCode",
            "required": true,
            "type": "string"
          },
          {
            "description": "Type of therapeutic link",
            "in": "query",
            "name": "therapeuticLinkType",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "No therapeutic link for the patient and 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 link"
        ],
        "description": "Revokes a therapeutic link",
        "operationId": "deleteTherapeuticLink"
      },
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Therapeutic link data",
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/therapeuticLink"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "409": {
            "description": "Therapeutic link 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 link"
        ],
        "description": "Creates a therapeutic link. The proof element is optional, and the proof type allowed values are: eidreading, eidencoding, sisreading and isireading. Default value is cardencoding_mobile, which means no proof is encoded.",
        "operationId": "createTherapeuticLink",
        "x-codegen-request-body-name": "therlink"
      }
    },
    "/therapeuticLinks/{patientSsin}": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN)",
            "in": "path",
            "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 qualification (NIHDI)",
            "in": "query",
            "name": "hcPartyNihii",
            "type": "string"
          },
          {
            "description": "Qualification code of the healthcare party, also called quality. The values are the one from Khmer, like persphysician, orgpharmacy, ... If another id is specified, the field is required",
            "in": "query",
            "name": "hcPartyQualificationCode",
            "type": "string"
          },
          {
            "collectionFormat": "multi",
            "description": "Type of therapeutic link. The therapeuticLinkType element is optional, and the allowed values are: nurseconsultation, nursereferral,  midwifeconsultation, referral, consultation, patientmanagement, gmd, gpconsultation, gpreferral, specialistconsultation, specialistreferral, pharmacydelivery and pharmacistreferral.",
            "in": "query",
            "items": {
              "type": "string"
            },
            "name": "therapeuticLinkType",
            "type": "array"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "items": {
                "$ref": "#/definitions/therapeuticLink"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "No therapeutic link for the patient and 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 link"
        ],
        "description": "Gets a therapeutic link",
        "operationId": "getTherapeuticLink"
      }
    }
  },
  "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"
    },
    "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"
    },
    "identifier": {
      "example": {
        "type": "type",
        "value": "value"
      },
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "patient": {
      "example": {
        "firstName": "firstName",
        "identifier": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ],
        "name": "name"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "identifier": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "identifier"
      ],
      "type": "object"
    },
    "proof": {
      "example": {
        "type": "type"
      },
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "therapeuticLink": {
      "example": {
        "endDate": "2000-01-23",
        "hcParty": {
          "firstName": "firstName",
          "identifier": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name",
          "qualificationCode": "qualificationCode"
        },
        "patient": {
          "firstName": "firstName",
          "identifier": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name"
        },
        "proof": {
          "type": "type"
        },
        "startDate": "2000-01-23",
        "type": "type"
      },
      "properties": {
        "endDate": {
          "format": "date",
          "type": "string"
        },
        "hcParty": {
          "$ref": "#/definitions/hcParty"
        },
        "patient": {
          "$ref": "#/definitions/patient"
        },
        "proof": {
          "$ref": "#/definitions/proof"
        },
        "startDate": {
          "format": "date",
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "hcParty",
        "patient",
        "type"
      ],
      "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 Therapeutic Link service"
      },
      "tokenUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/token",
      "type": "oauth2"
    }
  },
  "x-components": {}
}
