{
  "openapi": "3.1.0",
  "info": {
    "title": "Latvia Data API",
    "version": "0.1.0",
    "description": "Authenticated REST surface for Latvia Data planning, execution, and artifact retrieval."
  },
  "servers": [
    {
      "url": "/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/auth/me": {
      "get": {
        "summary": "Resolve current auth context",
        "responses": {
          "200": {
            "description": "Auth context"
          }
        }
      }
    },
    "/entities/search": {
      "get": {
        "summary": "Search live entities",
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "entity_type", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 10 } }
        ],
        "responses": {
          "200": {
            "description": "Search results"
          }
        }
      }
    },
    "/catalog/search": {
      "get": {
        "summary": "Search dataset catalog",
        "responses": {
          "200": {
            "description": "Catalog search results"
          }
        }
      }
    },
    "/plan": {
      "post": {
        "summary": "Persist a query plan",
        "responses": {
          "200": {
            "description": "Persisted plan"
          }
        }
      }
    },
    "/execute": {
      "post": {
        "summary": "Execute a query and persist an artifact",
        "responses": {
          "200": {
            "description": "Execution result"
          }
        }
      }
    },
    "/chat": {
      "post": {
        "summary": "One-call chat flow over the planner backend",
        "responses": {
          "200": {
            "description": "Chat execution result"
          }
        }
      }
    },
    "/follows": {
      "get": {
        "summary": "Read follow rows",
        "responses": {
          "200": {
            "description": "Follow list"
          }
        }
      },
      "post": {
        "summary": "Create a follow row",
        "responses": {
          "200": {
            "description": "Follow persisted"
          }
        }
      }
    },
    "/feed": {
      "get": {
        "summary": "Read feed events",
        "responses": {
          "200": {
            "description": "Feed events"
          }
        }
      }
    }
  }
}
