{
 "openapi": "3.1.0",
 "info": {
  "title": "Bed & Bot API",
  "version": "0",
  "description": "Source-linked technical data on R290 air-to-water heat pumps."
 },
 "servers": [
  {
   "url": "https://bedandbot.it"
  }
 ],
 "paths": {
  "/api/match": {
   "get": {
    "summary": "R290 heat pumps for a required capacity",
    "description": "Units whose Prated (EN 14825) for the given climate and application is within ±25% of capacity_kw, sorted by SCOP. Every value links to its primary source.",
    "parameters": [
     {
      "name": "capacity_kw",
      "in": "query",
      "required": true,
      "schema": {
       "type": "number",
       "minimum": 1,
       "maximum": 60
      }
     },
     {
      "name": "application_c",
      "in": "query",
      "schema": {
       "type": "integer",
       "enum": [
        35,
        55
       ],
       "default": 35
      }
     },
     {
      "name": "climate",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "average",
        "colder",
        "warmer"
       ],
       "default": "average"
      }
     },
     {
      "name": "session",
      "in": "query",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Matching units"
     }
    }
   }
  },
  "/api/contribute": {
   "post": {
    "summary": "Answer an open question with a public source",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "question",
         "source_url"
        ],
        "properties": {
         "question": {
          "type": "string"
         },
         "source_url": {
          "type": "string",
          "format": "uri"
         },
         "value": {
          "type": "string"
         },
         "unit": {
          "type": "string"
         },
         "note": {
          "type": "string",
          "maxLength": 500
         },
         "session": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Stored as unverified"
     }
    }
   }
  }
 }
}