{
  "openapi": "3.1.0",
  "info": {
    "title": "Hanta Monitor API",
    "version": "0.1.0",
    "description": "Structured feed endpoints for Hanta Monitor."
  },
  "servers": [
    {
      "url": "https://hantamonitor.com"
    }
  ],
  "paths": {
    "/api/feed": {
      "get": {
        "summary": "Get the current generated Hanta Monitor feed",
        "responses": {
          "200": {
            "description": "Current feed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Feed"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "summary": "Get basic service health",
        "responses": {
          "200": {
            "description": "Service is reachable"
          }
        }
      }
    },
    "/map/hotzones.json": {
      "get": {
        "summary": "Get source-backed country-level map overlays",
        "responses": {
          "200": {
            "description": "Current static map overlay payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MapOverlay"
                }
              }
            }
          }
        }
      }
    },
    "/live.json": {
      "get": {
        "summary": "Get generated live media candidate data",
        "responses": {
          "200": {
            "description": "Current live media candidate payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveFeed"
                }
              }
            }
          }
        }
      }
    },
    "/map/world-110m.json": {
      "get": {
        "summary": "Get self-hosted country boundary geometry",
        "responses": {
          "200": {
            "description": "TopoJSON world country geometry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopoJsonTopology"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Feed": {
        "type": "object",
        "required": ["schema_version", "generated_at", "status", "sources", "items"],
        "properties": {
          "schema_version": { "type": "integer" },
          "generated_at": { "type": "string", "format": "date-time" },
          "generator": { "type": "string" },
          "status": { "type": "string" },
          "refresh": { "type": "object" },
          "summary": { "type": "object" },
          "sources": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Source" }
          },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/FeedItem" }
          }
        }
      },
      "Source": {
        "type": "object",
        "required": ["id", "name", "rank", "url"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "rank": { "type": "string" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "FeedItem": {
        "type": "object",
        "required": ["id", "title", "source", "source_id", "source_rank", "url", "fetched_at", "classification", "summary"],
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "source": { "type": "string" },
          "source_id": { "type": "string" },
          "source_rank": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "published_at": { "type": ["string", "null"], "format": "date-time" },
          "fetched_at": { "type": "string", "format": "date-time" },
          "classification": { "type": "string" },
          "category": { "type": "string" },
          "location": { "type": "string" },
          "summary": { "type": "string" },
          "confidence": { "type": "string" }
        }
      },
      "MapOverlay": {
        "type": "object",
        "required": ["schema_version", "generated_at", "status", "precision", "status_semantics", "sources", "items"],
        "properties": {
          "schema_version": { "type": "integer" },
          "generated_at": { "type": "string", "format": "date-time" },
          "generator": { "type": "string" },
          "status": { "type": "string" },
          "precision": { "type": "string", "const": "country-level" },
          "status_semantics": {
            "type": "object",
            "additionalProperties": { "type": "string" }
          },
          "summary": { "type": "object" },
          "sources": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/MapSource" }
          },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/MapOverlayItem" }
          }
        }
      },
      "MapSource": {
        "type": "object",
        "required": ["id", "name", "rank", "url", "retrieved_at"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "rank": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "retrieved_at": { "type": "string", "format": "date-time" }
        }
      },
      "MapOverlayItem": {
        "type": "object",
        "required": ["id", "label", "scope", "geometry_id", "status", "last_seen_at", "source_ids", "summary", "precision_note"],
        "properties": {
          "id": { "type": "string" },
          "label": { "type": "string" },
          "scope": { "type": "string", "const": "country" },
          "geometry_id": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["baseline", "reported", "confirmed", "monitored-event", "context"]
          },
          "last_seen_at": { "type": "string", "format": "date-time" },
          "source_ids": {
            "type": "array",
            "items": { "type": "string" }
          },
          "feed_item_ids": {
            "type": "array",
            "items": { "type": "string" }
          },
          "summary": { "type": "string" },
          "precision_note": { "type": "string" }
        }
      },
      "LiveFeed": {
        "type": "object",
        "required": ["schema_version", "generated_at", "artifact_version", "generator", "status", "source_status", "summary", "sources", "items"],
        "properties": {
          "schema_version": { "type": "integer" },
          "generated_at": { "type": "string", "format": "date-time" },
          "artifact_version": { "type": "string" },
          "generator": { "type": "string" },
          "status": { "type": "string" },
          "source_status": { "type": "object" },
          "input_artifacts": { "type": "object" },
          "summary": { "type": "object" },
          "sources": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Source" }
          },
          "items": {
            "type": "array",
            "items": { "type": "object" }
          }
        }
      },
      "TopoJsonTopology": {
        "type": "object",
        "required": ["type", "objects", "arcs"],
        "properties": {
          "type": { "type": "string", "const": "Topology" },
          "objects": { "type": "object" },
          "arcs": { "type": "array" },
          "transform": { "type": "object" }
        }
      }
    }
  }
}
