{
	"openapi": "3.1.1",
	"info": {
		"title": "TWIN - Test Endpoints",
		"description": "REST API for TWIN - Test Endpoints.",
		"version": "1.0.0",
		"license": {
			"name": "Apache 2.0 License",
			"url": "https://opensource.org/licenses/Apache-2.0"
		}
	},
	"servers": [
		{
			"url": "https://localhost"
		}
	],
	"tags": [
		{
			"name": "Info",
			"description": "Information endpoints for the REST server."
		},
		{
			"name": "Health",
			"description": "Health endpoints for the REST server."
		}
	],
	"paths": {
		"/": {
			"get": {
				"operationId": "serverHealth",
				"summary": "Get the health for the server",
				"tags": [
					"Health"
				],
				"security": [
					{
						"jwtBearerAuthScheme": []
					}
				],
				"responses": {
					"200": {
						"description": "The health of the server.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ServerHealthResponse"
								},
								"examples": {
									"healthResponseOK": {
										"summary": "The response for the health request.",
										"value": {
											"status": "ok",
											"components": [
												{
													"source": "Database",
													"status": "ok",
													"category": "connectivity"
												},
												{
													"source": "Storage",
													"status": "ok",
													"category": "connectivity"
												}
											]
										}
									},
									"healthResponseWarning": {
										"summary": "The response for the health request with warnings.",
										"value": {
											"status": "warning",
											"components": [
												{
													"source": "Database",
													"status": "warning",
													"description": "slowRunning",
													"category": "connectivity"
												},
												{
													"source": "Storage",
													"status": "ok",
													"category": "connectivity"
												}
											]
										}
									},
									"healthResponseError": {
										"summary": "The response for the health request with errors.",
										"value": {
											"status": "error",
											"components": [
												{
													"source": "Database",
													"status": "ok",
													"category": "connectivity"
												},
												{
													"source": "Storage",
													"status": "error",
													"description": "storageFull",
													"category": "connectivity"
												}
											]
										}
									}
								}
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"401": {
						"description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "UnauthorizedError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"/favicon.ico": {
			"get": {
				"operationId": "serverFavIcon",
				"summary": "Get the favicon for the server",
				"tags": [
					"Info"
				],
				"responses": {
					"200": {
						"description": "The favicon for the server.",
						"content": {
							"image/x-icon": {
								"schema": {
									"$ref": "#/components/schemas/ServerFavIconResponse"
								}
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"/info": {
			"get": {
				"operationId": "serverInformation",
				"summary": "Get the information for the server",
				"tags": [
					"Info"
				],
				"responses": {
					"200": {
						"description": "The information about the server.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ServerInfo"
								},
								"examples": {
									"informationResponse": {
										"summary": "The response for the information request.",
										"value": {
											"name": "API Server",
											"version": "1.0.0"
										}
									}
								}
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"/livez": {
			"get": {
				"operationId": "serverLivez",
				"summary": "Get the livez status for the server",
				"tags": [
					"Info"
				],
				"responses": {
					"200": {
						"description": "The livez of the server.",
						"content": {
							"text/plain": {
								"schema": {
									"$ref": "#/components/schemas/ServerLivezResponse"
								},
								"examples": {
									"livezResponseOK": {
										"summary": "The response for the liveness request.",
										"value": "alive"
									},
									"livezResponseFailure": {
										"summary": "The response for the liveness request with errors.",
										"value": "dead"
									}
								}
							}
						},
						"headers": {
							"content-type": {
								"schema": {
									"type": "string"
								},
								"description": "e.g. text/plain"
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"/readyz": {
			"get": {
				"operationId": "serverReadyz",
				"summary": "Get the readyz status for the server",
				"tags": [
					"Info"
				],
				"responses": {
					"200": {
						"description": "The readyz of the server.",
						"content": {
							"text/plain": {
								"schema": {
									"$ref": "#/components/schemas/ServerReadyzResponse"
								},
								"examples": {
									"readyzResponseOK": {
										"summary": "The response for the readiness request.",
										"value": "ready"
									},
									"readyzResponseFailure": {
										"summary": "The response for the readiness request with errors.",
										"value": "not ready"
									}
								}
							}
						},
						"headers": {
							"content-type": {
								"schema": {
									"type": "string"
								},
								"description": "e.g. text/plain"
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"/spec": {
			"get": {
				"operationId": "serverSpec",
				"summary": "Get the OpenAPI specification for the endpoints",
				"tags": [
					"Info"
				],
				"responses": {
					"200": {
						"description": "The OpenAPI spec for the endpoints.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ServerSpecResponse"
								},
								"examples": {
									"specResponse": {
										"summary": "The response for the spec request.",
										"value": {
											"openapi": "3.1.0",
											"info": {},
											"paths": {}
										}
									}
								}
							}
						}
					},
					"400": {
						"description": "The server cannot process the request, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "GeneralError",
											"message": "errorMessage",
											"properties": {
												"foo": "bar"
											}
										}
									}
								}
							}
						}
					},
					"500": {
						"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								},
								"examples": {
									"exampleResponse": {
										"value": {
											"name": "InternalServerError",
											"message": "errorMessage"
										}
									}
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"schemas": {
			"Error": {
				"description": "Model to describe serialized error.",
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"description": "The name for the error."
					},
					"message": {
						"type": "string",
						"description": "The message for the error as an i18n key."
					},
					"source": {
						"type": "string",
						"description": "The source of the error."
					},
					"properties": {
						"type": "object",
						"additionalProperties": {},
						"description": "Any additional information for the error."
					},
					"stack": {
						"type": "string",
						"description": "The stack trace for the error."
					},
					"cause": {
						"$ref": "#/components/schemas/Error"
					}
				},
				"required": [
					"name",
					"message"
				]
			},
			"Health": {
				"description": "Provides health information for a component.",
				"type": "object",
				"properties": {
					"source": {
						"type": "string",
						"description": "The source of the health information."
					},
					"description": {
						"type": "string",
						"description": "The description of the component as an i18n key."
					},
					"category": {
						"$ref": "#/components/schemas/HealthCategory"
					},
					"status": {
						"$ref": "#/components/schemas/HealthStatus"
					},
					"error": {
						"$ref": "#/components/schemas/Error"
					},
					"message": {
						"type": "string",
						"description": "The message for the status if there are further details to provide as an i18n key."
					},
					"data": {
						"type": "object",
						"additionalProperties": {},
						"description": "Data to substitute in the i18n key for the message."
					},
					"grouped": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Health"
						},
						"description": "The grouped child components, if any."
					}
				},
				"required": [
					"source",
					"status"
				]
			},
			"HealthCategory": {
				"description": "The category of a health check.",
				"anyOf": [
					{
						"const": "connectivity",
						"description": "Connectivity health check for infrastructure connectors."
					},
					{
						"const": "application",
						"description": "Application health check for domain services."
					}
				]
			},
			"HealthStatus": {
				"description": "The health status of the component.",
				"anyOf": [
					{
						"const": "ok",
						"description": "OK."
					},
					{
						"const": "warning",
						"description": "Warning."
					},
					{
						"const": "error",
						"description": "Error."
					}
				]
			},
			"ServerFavIconResponse": {
				"type": "array",
				"items": {
					"type": "number"
				},
				"description": "The favicon for the server."
			},
			"ServerHealthResponse": {
				"type": "object",
				"properties": {
					"status": {
						"$ref": "#/components/schemas/HealthStatus"
					},
					"components": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Health"
						}
					}
				},
				"required": [
					"status",
					"components"
				],
				"description": "The health for the server."
			},
			"ServerInfo": {
				"description": "The information about the server.",
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"description": "The application name."
					},
					"version": {
						"type": "string",
						"description": "The version of the server."
					}
				},
				"required": [
					"name",
					"version"
				]
			},
			"ServerLivezResponse": {
				"anyOf": [
					{
						"const": "alive"
					},
					{
						"const": "dead"
					}
				],
				"description": "The livez information for the server."
			},
			"ServerReadyzResponse": {
				"anyOf": [
					{
						"const": "ready"
					},
					{
						"const": "not ready"
					}
				],
				"description": "The readyz information for the server."
			},
			"ServerSpecResponse": {
				"description": "The spec for the server."
			}
		},
		"securitySchemes": {
			"jwtBearerAuthScheme": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "JWT"
			}
		}
	}
}
