{
  "openapi": "3.0.1",
  "info": {
    "title": "DocumentService API",
    "description": "API für die Verwaltung von Dokumentvorlagen und Generierung von Dokumenten",
    "version": "v1"
  },
  "paths": {
    "/api/Templates": {
      "get": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Abrufen alle Dokumentenvorlagen",
        "description": "Abrufen aller Dokumentenvorlagen mit einem gegebenen Limit und Offset",
        "operationId": "GetTemplates",
        "parameters": [
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 15
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Templates/{templateId}": {
      "get": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Abrufen einer Dokumentenvorlage",
        "description": "Abrufen einer Dokumentenvorlage aufgrund einer TemplateId",
        "operationId": "GetTemplateByTemplateIdAndTenant",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Erstellen einer Dokumentenvorlage",
        "description": "Erstellen einer Dokumentenvorlage aufgrund der übergebenen Daten",
        "operationId": "CreateTemplate",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "description",
                  "fileJsonSchema",
                  "fileListLabel"
                ],
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "fileListLabel": {
                    "type": "string",
                    "format": "binary"
                  },
                  "fileJsonSchema": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "description": {
                  "style": "form"
                },
                "fileListLabel": {
                  "style": "form"
                },
                "fileJsonSchema": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Aktualisieren einer Dokumentenvorlage",
        "description": "Aktualisieren einer Dokumentenvorlage aufgrund einer TemplateId",
        "operationId": "UpdateTemplate",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "description",
                  "fileJsonSchema",
                  "fileListLabel"
                ],
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "fileListLabel": {
                    "type": "string",
                    "format": "binary"
                  },
                  "fileJsonSchema": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "description": {
                  "style": "form"
                },
                "fileListLabel": {
                  "style": "form"
                },
                "fileJsonSchema": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Löschen einer Dokumentenvorlage",
        "description": "Löschen (Setzen von DeletedOn & -By) einer Dokumentenvorlage aufgrund einer TemplateId",
        "operationId": "DeleteTemplate",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Documents/{templateId}": {
      "post": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Generierung eines Dokuments",
        "description": "Generierung eines PDF-Dokuments anhand einer Dokumentenvorlage und JSON-Daten. Die JSON-Daten müssen dem Schema der Dokumentenvorlage entsprechen. Rückgabe als PDF-Datei.",
        "operationId": "GenerateDocument",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Documents/{templateId}/sample": {
      "get": {
        "tags": [
          "Eis.DocumentService"
        ],
        "summary": "Ermittle Sample-Data für PDF-Dokumentengenerierung",
        "description": "Ermittle Sample-Data für PDF-Dokumentengenerierung anhand der Dokumentvorlage mit der TemplateId.",
        "operationId": "GetSampleData",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://qsidp-eis.egeli-apps.dev/connect/authorize",
            "tokenUrl": "https://qsidp-eis.egeli-apps.dev/connect/token",
            "scopes": {
              "templates": "templates",
              "openid": "openid",
              "profile": "profile"
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [ ]
    }
  ]
}