{
  "openapi": "3.1.0",
  "info": {
    "title": "Watchwise Home public lookup API",
    "version": "1.0.0",
    "description": "Bounded, read-only access to the public eufy camera comparison used by Watchwise Home."
  },
  "servers": [
    { "url": "https://www.watchwisehome.com" }
  ],
  "paths": {
    "/api/lookup": {
      "get": {
        "operationId": "lookupCameras",
        "summary": "Find public camera comparison records",
        "description": "Use an exact id, short query, use-case, price, solar, or continuous-recording filter. The operation is read-only and bounded.",
        "parameters": [
          { "name": "id", "in": "query", "schema": { "type": "string", "pattern": "^[a-z0-9-]+$" }, "description": "Stable id such as solocam-s340." },
          { "name": "query", "in": "query", "schema": { "type": "string", "maxLength": 120 }, "description": "Short text query." },
          { "name": "use_case", "in": "query", "schema": { "type": "string", "enum": ["small-area", "open-yard", "centralized-4k-system", "continuous-recording"] } },
          { "name": "max_price_usd", "in": "query", "schema": { "type": "number", "minimum": 0 } },
          { "name": "solar", "in": "query", "schema": { "type": "boolean" } },
          { "name": "continuous_recording", "in": "query", "schema": { "type": "boolean" } }
        ],
        "responses": {
          "200": {
            "description": "Matching records, possibly an empty data array.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LookupResponse" } } }
          },
          "400": { "description": "Invalid filter." },
          "404": { "description": "The requested stable id was not found." }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "health",
        "summary": "Read public service health",
        "responses": { "200": { "description": "Service is available." } }
      }
    }
  },
  "components": {
    "schemas": {
      "CameraRecord": {
        "type": "object",
        "required": ["id", "model", "price_usd", "verification_date", "source_url"],
        "properties": {
          "id": { "type": "string" },
          "model": { "type": "string" },
          "form_factor": { "type": "string" },
          "resolution": { "type": "string" },
          "field_of_view": { "type": "string" },
          "power_and_solar": { "type": "string" },
          "has_solar": { "type": "boolean" },
          "storage": { "type": "string" },
          "recording_mode": { "type": "string" },
          "continuous_recording_supported": { "type": "boolean" },
          "price_usd": { "type": "number" },
          "price_basis": { "type": "string" },
          "verification_date": { "type": "string", "format": "date" },
          "recommendation": { "type": "string" },
          "official_product_url": { "type": "string", "format": "uri" },
          "notes": { "type": "string" },
          "source_url": { "type": "string", "format": "uri" }
        }
      },
      "LookupResponse": {
        "type": "object",
        "required": ["data", "count", "source_url", "source_updated_at"],
        "properties": {
          "data": { "type": "array", "items": { "$ref": "#/components/schemas/CameraRecord" } },
          "count": { "type": "integer", "minimum": 0 },
          "query": { "type": "string" },
          "id": { "type": "string" },
          "source_url": { "type": "string", "format": "uri" },
          "source_updated_at": { "type": "string", "format": "date" },
          "links": { "type": "object", "additionalProperties": { "type": "string", "format": "uri" } }
        }
      }
    }
  }
}
