{
  "openapi": "3.1.0",
  "info": {
    "title": "Rubicon Flood Control public API",
    "version": "1.0.0",
    "description": "Read Rubicon's services, pricing policy, service areas and FAQs; check open appointment times; book an on-site visit. Bookings with a Turnstile token are confirmed instantly; bookings without one (AI agents) are held and confirmed by phone.",
    "contact": {
      "name": "Rubicon Flood Control",
      "email": "info@rubiconflood.com",
      "url": "https://rubiconflood.com"
    }
  },
  "servers": [
    {
      "url": "https://rubiconflood.com"
    }
  ],
  "paths": {
    "/api/catalog.json": {
      "get": {
        "operationId": "getCatalog",
        "summary": "Everything in one document",
        "responses": {
          "200": {
            "description": "Catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          }
        }
      }
    },
    "/api/business": {
      "get": {
        "operationId": "getBusiness",
        "summary": "Contact details, address, hours",
        "responses": {
          "200": {
            "description": "Business info"
          }
        }
      }
    },
    "/api/services": {
      "get": {
        "operationId": "listServices",
        "summary": "Bookable services with price and duration",
        "responses": {
          "200": {
            "description": "Services"
          }
        }
      }
    },
    "/api/pricing": {
      "get": {
        "operationId": "getPricing",
        "summary": "Pricing policy and cost drivers",
        "responses": {
          "200": {
            "description": "Pricing"
          }
        }
      }
    },
    "/api/areas": {
      "get": {
        "operationId": "listAreas",
        "summary": "Service areas",
        "responses": {
          "200": {
            "description": "Areas"
          }
        }
      }
    },
    "/api/faqs": {
      "get": {
        "operationId": "searchFaqs",
        "summary": "Search FAQs",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "FAQ results"
          }
        }
      }
    },
    "/api/availability": {
      "get": {
        "operationId": "getAvailability",
        "summary": "Open appointment times (America/New_York)",
        "parameters": [
          {
            "name": "service",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "flood-barrier-assessment",
                "flood-barrier-inspection"
              ],
              "default": "flood-barrier-assessment"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 45,
              "default": 14
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Days with open slots. Use a slot's `start` when booking."
          }
        }
      }
    },
    "/api/bookings": {
      "post": {
        "operationId": "createBooking",
        "summary": "Book a visit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "service",
                  "start",
                  "name",
                  "phone",
                  "email",
                  "address",
                  "city",
                  "zip"
                ],
                "properties": {
                  "service": {
                    "type": "string",
                    "enum": [
                      "flood-barrier-assessment",
                      "flood-barrier-inspection"
                    ]
                  },
                  "start": {
                    "type": "string",
                    "description": "Slot start exactly as returned by check_availability, e.g. 2026-11-10T08:30:00-05:00"
                  },
                  "name": {
                    "type": "string",
                    "description": "Full name of the property owner or manager"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone number Rubicon will call to confirm"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "address": {
                    "type": "string",
                    "description": "Street address of the property to visit"
                  },
                  "city": {
                    "type": "string"
                  },
                  "zip": {
                    "type": "string",
                    "pattern": "^\\d{5}$"
                  },
                  "propertyType": {
                    "type": "string",
                    "enum": [
                      "single-family",
                      "seasonal",
                      "condo-townhouse",
                      "commercial"
                    ]
                  },
                  "openings": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "garage",
                        "door",
                        "slider",
                        "lanai"
                      ]
                    },
                    "description": "Openings to protect"
                  },
                  "concern": {
                    "type": "string",
                    "enum": [
                      "hurricane-surge",
                      "heavy-rain",
                      "king-tide",
                      "repeat-flooding",
                      "planning-ahead"
                    ]
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "turnstileToken": {
                    "type": "string",
                    "description": "Cloudflare Turnstile token (browser bookings only)"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Booked (status confirmed) or held for phone confirmation (status pending_confirmation)"
          },
          "409": {
            "description": "Slot not available; body.nextAvailable lists alternatives"
          },
          "422": {
            "description": "Invalid fields; body.fields explains each"
          },
          "429": {
            "description": "Too many requests"
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "operationId": "sendMessage",
        "summary": "Send a message (requires Turnstile token)",
        "responses": {
          "201": {
            "description": "Received"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Catalog": {
        "type": "object",
        "description": "See /api/catalog.json",
        "properties": {
          "business": {
            "type": "object"
          },
          "bookableServices": {
            "type": "array"
          },
          "pricing": {
            "type": "object"
          },
          "serviceAreas": {
            "type": "array"
          },
          "faqs": {
            "type": "array"
          }
        }
      }
    },
    "securitySchemes": {
      "agentKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Optional partner key for instantly confirmed agent bookings"
      }
    }
  }
}