{
  "openapi": "3.1.0",
  "info": {
    "title": "OMPU scAi-Fi reader",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://ompu.eu"
    }
  ],
  "paths": {
    "/scaifi/catalog.json": {
      "get": {
        "operationId": "catalog",
        "responses": {
          "200": {
            "description": "Versioned catalog"
          }
        }
      }
    },
    "/scaifi/graph.json": {
      "get": {
        "operationId": "graph",
        "responses": {
          "200": {
            "description": "Attributed edges and unresolved references"
          }
        }
      }
    },
    "/scaifi/story/{id}.json": {
      "get": {
        "operationId": "story",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original Markdown and provenance"
          },
          "404": {
            "description": "Unknown story"
          }
        }
      }
    },
    "/scaifi/api/assemble": {
      "post": {
        "operationId": "assembleReadingSequence",
        "description": "Explicit opt-in to provider processing; does not rewrite stories or store reader queries.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 400
                  },
                  "language": {
                    "enum": [
                      "any",
                      "ru",
                      "en",
                      "zh"
                    ],
                    "default": "any"
                  },
                  "read": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string"
                    }
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4,
                    "default": 4
                  },
                  "include_text": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "mode jev, abstained, or editorial_fallback; exact texts and provenance"
          },
          "400": {
            "description": "Invalid input"
          },
          "413": {
            "description": "Body exceeds 4096 bytes"
          },
          "415": {
            "description": "Requires JSON"
          }
        }
      }
    }
  }
}
