{
  "openapi": "3.1.0",
  "info": {
    "title": "Greenbone Feed Key",
    "description": "Greenbone Feed Key API",
    "contact": {
      "name": "Greenbone AG",
      "url": "https://www.greenbone.net"
    },
    "license": {
      "name": "AGPL-3.0-or-later",
      "url": "https://www.gnu.org/licenses/agpl-3.0.txt"
    },
    "version": "0.3.2"
  },
  "paths": {
    "/api/v1/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Check the health status of the service.",
        "operationId": "health_check",
        "responses": {
          "200": {
            "description": "Health check OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "OK server is healthy",
                  "status": "success"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/key": {
      "get": {
        "tags": [
          "Key"
        ],
        "summary": "Download the current feed key file.",
        "operationId": "download_key",
        "responses": {
          "200": {
            "description": "Key downloaded successfully",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Unauthorized",
                  "status": "error"
                }
              }
            }
          },
          "404": {
            "description": "Key not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key not available",
                  "status": "error"
                }
              }
            }
          }
        },
        "security": [
          {
            "jwt_auth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Key"
        ],
        "summary": "Upload a new feed key file.",
        "operationId": "upload_key",
        "requestBody": {
          "description": "The key file to upload",
          "content": {
            "application/octet-stream": {}
          }
        },
        "responses": {
          "200": {
            "description": "Key uploaded successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key uploaded successfully",
                  "status": "success"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Failed to validate key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Bad request: Key upload failed. Failed to validate key. Invalid Key data",
                  "status": "error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Unauthorized",
                  "status": "error"
                }
              }
            }
          },
          "500": {
            "description": "Key upload failed. Could not write to file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key upload failed. Could not write to file.",
                  "status": "error"
                }
              }
            }
          }
        },
        "security": [
          {
            "jwt_auth": []
          }
        ]
      },
      "post": {
        "tags": [
          "Key"
        ],
        "summary": "Upload a new feed key as a multipart/form-data file upload.",
        "operationId": "upload_key_multipart",
        "requestBody": {
          "description": "File to upload",
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "contentMediaType": "application/octet-stream"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Key upload successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key uploaded successfully",
                  "status": "success"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Failed to validate key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Bad request: Key upload failed. Failed to validate key. Invalid Key data",
                  "status": "error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Unauthorized",
                  "status": "error"
                }
              }
            }
          },
          "500": {
            "description": "Key upload failed. Could not write to file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key upload failed. Could not write to file.",
                  "status": "error"
                }
              }
            }
          }
        },
        "security": [
          {
            "jwt_auth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Key"
        ],
        "summary": "Delete the current feed key.",
        "operationId": "delete_key",
        "responses": {
          "200": {
            "description": "Key deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key deleted successfully",
                  "status": "success"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Unauthorized",
                  "status": "error"
                }
              }
            }
          },
          "500": {
            "description": "Key deletion failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Key deletion failed",
                  "status": "error"
                }
              }
            }
          }
        },
        "security": [
          {
            "jwt_auth": []
          }
        ]
      }
    },
    "/api/v1/key/status": {
      "get": {
        "tags": [
          "Key"
        ],
        "summary": "Status of the current feed key.",
        "operationId": "key_status",
        "responses": {
          "200": {
            "description": "Status of the current feed key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyStatus"
                },
                "example": {
                  "hasKey": true
                }
              }
            }
          },
          "500": {
            "description": "Getting the Key Status failed because of a File error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonResponse"
                },
                "example": {
                  "message": "Internal Server Error. File error.",
                  "status": "error"
                }
              }
            }
          }
        },
        "security": [
          {
            "jwt_auth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "JsonResponse": {
        "type": "object",
        "required": [
          "status",
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "KeyStatus": {
        "type": "object",
        "required": [
          "hasKey"
        ],
        "properties": {
          "hasKey": {
            "type": "boolean"
          }
        }
      }
    },
    "securitySchemes": {
      "jwt_auth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "tags": [
    {
      "name": "Health",
      "description": "Health check operations"
    },
    {
      "name": "Key",
      "description": "Key management operations"
    }
  ]
}