{
  "openapi": "3.0.4",
  "info": {
    "title": "ReportService",
    "description": "Generates reports."
  },
  "paths": {
    "/api/v1/docx/fill": {
      "post": {
        "tags": [
          "DocxFill"
        ],
        "summary": "Fills a DOCX template with provided data.",
        "description": "Accepts a DOCX template and JSON data. Set validate=true to require the embedded schema and reject invalid data or bindings before returning the filled DOCX.",
        "parameters": [
          {
            "name": "X-Culture",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "de-CH"
            }
          },
          {
            "name": "validate",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FillForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/docx/validatedfill": {
      "post": {
        "tags": [
          "DocxFill"
        ],
        "summary": "Validates and fills a DOCX template with provided data.",
        "description": "Equivalent to /docx/fill?validate=true. Requires an embedded report schema. Returns a filled DOCX or structured validation errors.",
        "parameters": [
          {
            "name": "X-Culture",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "de-CH"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FillForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/docx/validate": {
      "post": {
        "tags": [
          "DocxFill"
        ],
        "summary": "Validates DOCX data and bindings without returning a filled document.",
        "description": "Accepts the same template, JSON data, and culture as validated filling. Runs an in-memory fill to check the embedded schema and evaluated bindings; returns valid=true or structured validation errors. The source document is unchanged.",
        "parameters": [
          {
            "name": "X-Culture",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "de-CH"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FillForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocxValidationResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/addin/config.json": {
      "get": {
        "tags": [
          "ISE.Reporting.ApiService"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/sample-data/generate": {
      "post": {
        "tags": [
          "ReportData"
        ],
        "summary": "Generate random JSON data from a supported JSON Schema.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Content Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/infer": {
      "post": {
        "tags": [
          "ReportData"
        ],
        "summary": "Infer a JSON Schema from observed JSON data.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Content Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/docx/schema/infer": {
      "post": {
        "tags": [
          "ReportData"
        ],
        "summary": "Infer and attach a schema and optionally sample data to a DOCX.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ReportDataForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Content Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/xlsx/schema/infer": {
      "post": {
        "tags": [
          "ReportData"
        ],
        "summary": "Infer and attach a schema and optionally sample data to an XLSX.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ReportDataForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Content Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/xlsx/generate": {
      "post": {
        "tags": [
          "XlsxFill"
        ],
        "summary": "Fills a new Xlsx document with provided data.",
        "description": "Accepts json-data and returns the generated Xlsx document.",
        "parameters": [
          {
            "name": "X-Culture",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "de-CH"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateDataObject"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DocxValidationResponse": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "FillForm": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "fillDataJson": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GenerateDataObject": {
        "type": "object",
        "properties": {
          "SheetName": {
            "type": "string",
            "nullable": true
          },
          "Data": { },
          "HeaderNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "HeaderExpressions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "ReportDataForm": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "data": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "attachData": {
            "type": "boolean"
          },
          "removeData": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "description": "API Key needed to access the endpoints. You can get one from the administrator.",
        "name": "X-API-KEY",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "ApiKey": [ ]
    }
  ],
  "tags": [
    {
      "name": "DocxFill"
    },
    {
      "name": "ISE.Reporting.ApiService"
    },
    {
      "name": "ReportData"
    },
    {
      "name": "XlsxFill"
    }
  ]
}