{
  "openapi": "3.1.0",
  "info": {
    "title": "House Washing Lincoln quote API",
    "version": "1.1.0",
    "description": "Submit a free house-washing quote for Premier Outdoor Services in Lincoln, NE. Visiting agents should use the native homepage WebMCP tool submit_house_washing_quote. REST assistants MUST POST to /api/agent/leads with X-Lead-Source: agent. The homepage form posts to /api/leads and is counted as a human. Do not invent contact details."
  },
  "servers": [{ "url": "https://housewashinglincoln.com" }],
  "paths": {
    "/api/agent/leads": {
      "get": {
        "summary": "How assistants submit a quote",
        "operationId": "describeAgentQuote",
        "responses": {
          "200": { "description": "Contract, example, and JSON Schema" }
        }
      },
      "post": {
        "summary": "Request a free quote (AI assistant or WebMCP)",
        "description": "Recorded as source=webmcp when X-Lead-Source is webmcp, otherwise source=agent.",
        "operationId": "createAgentQuote",
        "parameters": [
          {
            "name": "X-Lead-Source",
            "in": "header",
            "description": "webmcp = native site tool. agent = direct REST. /api/agent/leads defaults to agent if omitted.",
            "schema": { "type": "string", "enum": ["agent", "webmcp"] }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Lead" },
              "example": {
                "name": "Jane Smith",
                "phone": "4025550123",
                "address": "Lincoln, NE",
                "notes": "Two-story vinyl, algae on the north side",
                "contact": "call",
                "contactPreference": "call"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Accepted and emailed to the Lincoln team",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "id": { "type": "string", "format": "uuid" },
                    "source": { "type": "string", "enum": ["agent", "webmcp"] }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/leads": {
      "get": {
        "summary": "How to submit a quote",
        "operationId": "describeQuote",
        "responses": {
          "200": { "description": "Contract, example, and JSON Schema" }
        }
      },
      "post": {
        "summary": "Request a free quote",
        "operationId": "createQuote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Lead" },
              "example": {
                "name": "Jane Smith",
                "phone": "4025550123",
                "address": "Lincoln, NE",
                "notes": "Two-story vinyl, algae on the north side",
                "contact": "call",
                "contactPreference": "call",
                "source": "human"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": { "$ref": "#/components/schemas/Lead" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Accepted and emailed to the Lincoln team",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean", "const": true },
                    "id": { "type": "string", "format": "uuid" },
                    "source": { "type": "string", "enum": ["human", "agent", "webmcp"] }
                  }
                }
              }
            }
          },
          "422": { "description": "Validation errors" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Lead": {
        "type": "object",
        "required": ["name", "phone"],
        "properties": {
          "name": { "type": "string", "minLength": 2, "maxLength": 120 },
          "phone": { "type": "string", "minLength": 10, "maxLength": 32, "description": "10-digit US number" },
          "address": { "type": "string", "maxLength": 240 },
          "notes": { "type": "string", "maxLength": 2000 },
          "contact": { "type": "string", "enum": ["call", "text"], "default": "call" },
          "contactPreference": { "type": "string", "enum": ["call", "text"], "default": "call", "description": "Alias of contact. Native WebMCP uses this field." },
          "source": { "type": "string", "enum": ["human", "agent", "webmcp"], "default": "human" }
        }
      }
    }
  }
}
