{
  "openapi": "3.1.0",
  "info": {
    "title": "WaterFilterHelp Agent API",
    "version": "1.1.0",
    "description": "Programmatic water treatment recommendations and free quote requests for Canadian homeowners."
  },
  "servers": [
    {
      "url": "https://waterfilterhelp.ca"
    }
  ],
  "paths": {
    "/api/v1/quotes": {
      "post": {
        "operationId": "submitWaterFilterQuote",
        "summary": "Submit a water filtration quote request",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wizard": {
      "get": {
        "operationId": "getWizardManifest",
        "summary": "Wizard capability manifest",
        "responses": {
          "200": {
            "description": "Machine-readable wizard schema",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wizard/recommend": {
      "post": {
        "operationId": "recommendWaterTreatmentStack",
        "summary": "Recommend a water treatment stack from symptoms",
        "description": "No contact info required. Returns a recommended equipment stack, CAD cost ranges, and quote_handoff fields for POST /api/v1/quotes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WizardRecommendRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recommendation generated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WizardRecommendResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          }
        }
      },
      "get": {
        "operationId": "getWizardManifest",
        "summary": "Wizard capability manifest",
        "responses": {
          "200": {
            "description": "Machine-readable wizard schema",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "QuoteRequest": {
        "type": "object",
        "required": [
          "consent",
          "issue_type",
          "urgency",
          "name",
          "email",
          "phone",
          "address",
          "city",
          "province"
        ],
        "properties": {
          "consent": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "issue_type": {
            "type": "string",
            "enum": [
              "whole_home",
              "reverse_osmosis",
              "softener",
              "well_treatment",
              "carbon_sediment",
              "pfas_lead",
              "service_repair",
              "water_testing",
              "advice",
              "other"
            ]
          },
          "system_type": {
            "type": "string",
            "enum": [
              "municipal",
              "well",
              "cottage"
            ]
          },
          "urgency": {
            "type": "string",
            "enum": [
              "asap",
              "1_3_months",
              "researching"
            ]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "details": {
            "type": "string"
          },
          "agent_source": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "description": "Honeypot — leave empty"
          }
        }
      },
      "WizardRecommendRequest": {
        "type": "object",
        "required": [
          "source",
          "province"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "municipal",
              "well",
              "cottage"
            ]
          },
          "province": {
            "type": "string",
            "description": "Canadian province/territory code",
            "enum": [
              "AB",
              "BC",
              "MB",
              "NB",
              "NL",
              "NS",
              "NT",
              "NU",
              "ON",
              "PE",
              "QC",
              "SK",
              "YT"
            ]
          },
          "postal": {
            "type": "string",
            "description": "Optional Canadian postal code"
          },
          "postal_code": {
            "type": "string",
            "description": "Alias for postal"
          },
          "smell": {
            "type": "string",
            "enum": [
              "none",
              "rotten_eggs",
              "chlorine",
              "musty"
            ],
            "default": "none"
          },
          "colour": {
            "type": "string",
            "enum": [
              "clear",
              "yellow_orange",
              "cloudy",
              "black_brown"
            ],
            "default": "clear"
          },
          "color": {
            "type": "string",
            "enum": [
              "clear",
              "yellow_orange",
              "cloudy",
              "black_brown"
            ],
            "description": "US spelling alias for colour"
          },
          "hardness": {
            "type": "boolean",
            "default": false
          },
          "iron_stains": {
            "type": "boolean",
            "default": false
          },
          "bacteria_concern": {
            "type": "boolean",
            "default": false
          },
          "has_test": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "WizardRecommendResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "summary": {
            "type": "string"
          },
          "stack": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                },
                "cost_low": {
                  "type": "number"
                },
                "cost_high": {
                  "type": "number"
                },
                "optional": {
                  "type": "boolean"
                }
              }
            }
          },
          "total_low": {
            "type": "number"
          },
          "total_high": {
            "type": "number"
          },
          "currency": {
            "type": "string",
            "enum": [
              "CAD"
            ]
          },
          "primary_service": {
            "type": "string"
          },
          "urgency_hint": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "quote_handoff": {
            "type": "object"
          },
          "quote_endpoint": {
            "type": "string"
          },
          "human_wizard_url": {
            "type": "string"
          }
        }
      }
    }
  }
}
