{
  "openapi": "3.0.3",
  "info": {
    "title": "Burn Observer Civic Safety API",
    "version": "2.5.0",
    "description": "High-reliability, deterministic civic open-burning decision engine. Synthesizes National Weather Service (NWS) point forecasts, USGS/NIFC wildfire perimeters, automated 911 CAD dispatch webhooks, state DNR permitting records, and municipal fire ordinances under a Zero False Greens safety contract.",
    "termsOfService": "https://burn.observer/terms",
    "contact": {
      "name": "Public Safety Integration Team",
      "email": "support@burn.observer",
      "url": "https://burn.observer"
    },
    "license": {
      "name": "Civic Public Safety Access License",
      "url": "https://burn.observer/terms"
    }
  },
  "servers": [
    {
      "url": "https://burn.observer",
      "description": "Production Global Edge Network (Cloudflare Anycast)"
    }
  ],
  "tags": [
    {
      "name": "Civic Status",
      "description": "Deterministic open-burning status queries and physical setback evaluation."
    },
    {
      "name": "Burn Coverage & Horizons",
      "description": "Regional geospatial vector coverage of civic burn bans, DNR permitting, and local statuses."
    },
    {
      "name": "Wildfires & Hazards",
      "description": "Active satellite wildfire incident feeds and geospatial hazard layers."
    },
    {
      "name": "CAD & Emergency Dispatch",
      "description": "911 computer-aided dispatch webhook ingestion and emergency ban automation."
    },
    {
      "name": "Fire Command (Chief Portal)",
      "description": "Department-isolated mobile portal for verified fire chiefs."
    },
    {
      "name": "Municipal B2G Services",
      "description": "USFA department onboarding, automated invoicing, and W-9 tax vouchers."
    },
    {
      "name": "Commercial Partner APIs",
      "description": "B2B geospatial APIs for third-party recreation, mapping, and hunting platforms (e.g., OnX Hunt, Gaia GPS, AllTrails)."
    },
    {
      "name": "Regulatory Catalog",
      "description": "State statutory open-burning codes and municipal ordinances."
    },
    {
      "name": "Civic Telephony & Automated IVR",
      "description": "Municipal phone hotline integration, interactive DTMF keypads, and VoiceXML."
    },
    {
      "name": "System Diagnostics",
      "description": "Edge telemetry, round-trip pings, and upstream service heartbeat."
    }
  ],
  "paths": {
    "/api/voice": {
      "get": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "Automated Municipal Phone Service & IVR Voice Webhook",
        "description": "Generates real-time TwiML XML, W3C VoiceXML 2.1, Asterisk/FreePBX dialplan, JSON, or Plain Text voice readouts for municipal burn hotlines.",
        "operationId": "getVoiceStatus",
        "parameters": [
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "township",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "MI"
            }
          },
          {
            "name": "fdid",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es"
              ],
              "default": "en"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "xml",
                "vxml",
                "json",
                "text",
                "asterisk"
              ],
              "default": "xml"
            }
          },
          {
            "name": "Digits",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "TwiML XML, VoiceXML 2.1, Asterisk dialplan, or JSON telephony payload."
          }
        }
      },
      "post": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "Inbound Carrier Telephony Webhook",
        "description": "Handles carrier POST webhooks with form-encoded Digits, To, and optional webhook signature headers.",
        "operationId": "postVoiceWebhook",
        "responses": {
          "200": {
            "description": "TwiML XML or VoiceXML response."
          }
        }
      }
    },
    "/api/voice/gather": {
      "post": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "DTMF Keypad Gather Action Callback",
        "description": "Handles caller DTMF responses (5-digit ZIP, burn categories, language toggle, permit desk transfer, or Chief PIN portal handoff).",
        "operationId": "postVoiceGather",
        "responses": {
          "200": {
            "description": "TwiML XML or VoiceXML response."
          }
        }
      },
      "get": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "DTMF Keypad Gather Action GET Fallback",
        "operationId": "getVoiceGather",
        "responses": {
          "200": {
            "description": "TwiML XML or VoiceXML response."
          }
        }
      }
    },
    "/api/voice/chief": {
      "post": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "Dial-In Fire Chief Emergency Ban Control IVR",
        "description": "Authenticates authorized Fire Chiefs by DTMF PIN with rate limiting and HMAC-SHA256 short-lived session tokens to toggle RED emergency bans or clear overrides.",
        "operationId": "postVoiceChief",
        "responses": {
          "200": {
            "description": "TwiML XML or VoiceXML Chief dial-in control menu."
          }
        }
      },
      "get": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "Dial-In Fire Chief IVR Session Continuation",
        "operationId": "getVoiceChief",
        "responses": {
          "200": {
            "description": "TwiML XML or VoiceXML Chief dial-in control menu."
          }
        }
      }
    },
    "/api/voice/metrics": {
      "get": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "Zero-PII Daily 911 Call Deflection Telemetry",
        "description": "Returns daily anonymized telephony call-deflection counts by verdict status, burn category, and language.",
        "operationId": "getVoiceMetrics",
        "parameters": [
          {
            "name": "fdid",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Daily aggregate call deflection metrics without caller PII."
          }
        }
      }
    },
    "/api/voice/dialplan": {
      "get": {
        "tags": [
          "Civic Telephony & Automated IVR"
        ],
        "summary": "On-Premise Asterisk & FreePBX Dialplan Generator",
        "description": "Generates a turnkey Asterisk extensions.conf AGI/CURL snippet bound to the jurisdiction parameters.",
        "operationId": "getVoiceDialplan",
        "parameters": [
          {
            "name": "fdid",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "MI"
            }
          },
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "township",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es"
              ],
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Plain text Asterisk / FreePBX extensions_custom.conf snippet."
          }
        }
      }
    },
    "/api/coverage": {
      "get": {
        "tags": [
          "Burn Coverage & Horizons"
        ],
        "summary": "Query Regional Burn Status Coverage Polygons",
        "description": "Returns live aggregated civic open-burning status verdicts (GREEN, ORANGE, RED, GRAY) across regional county jurisdictions within a geographic bounding box.",
        "operationId": "getRegionalBurnCoverage",
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "-87.0,42.0,-84.0,45.0"
            },
            "description": "Geospatial bounding box in format minLng,minLat,maxLng,maxLat (WGS84 EPSG:4326)."
          },
          {
            "name": "burnType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN_BRUSH_PILE",
                "RECREATIONAL_PIT",
                "BURN_BARREL",
                "AGRICULTURAL_FIELD"
              ],
              "default": "OPEN_BRUSH_PILE"
            },
            "description": "Outdoor burn apparatus evaluated across jurisdictions."
          },
          {
            "name": "counties",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "WI:Dane:43.07:-89.40|IA:Polk:41.68:-93.57"
            },
            "description": "Pipe-delimited viewport county centroids (up to 80) in STATE:Name:lat:lng format for dynamic Open-Meteo coverage."
          }
        ],
        "responses": {
          "200": {
            "description": "Regional burn coverage successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "example": "BURN_OBSERVER_REGIONAL_COVERAGE"
                    },
                    "count": {
                      "type": "integer",
                      "example": 10
                    },
                    "coverage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "MI_NEWAYGO"
                          },
                          "state": {
                            "type": "string",
                            "example": "MI"
                          },
                          "county": {
                            "type": "string",
                            "example": "Newaygo"
                          },
                          "name": {
                            "type": "string",
                            "example": "Newaygo"
                          },
                          "lat": {
                            "type": "number",
                            "example": 43.55
                          },
                          "lng": {
                            "type": "number",
                            "example": -85.8
                          },
                          "radiusMeters": {
                            "type": "number",
                            "example": 28968
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "GREEN",
                              "ORANGE",
                              "RED",
                              "GRAY"
                            ],
                            "example": "GREEN"
                          },
                          "canBurn": {
                            "type": "boolean",
                            "example": true
                          },
                          "subtype": {
                            "type": "string",
                            "example": "DNR_PERMIT_ACTIVE"
                          },
                          "headline": {
                            "type": "string",
                            "example": "Open burning permitted today per Michigan DNR"
                          }
                        }
                      }
                    },
                    "stateRollups": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Per-US-state restriction rollups and partial-ban hotspot centroids for honest zoomed-out rendering."
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/wildfires": {
      "get": {
        "tags": [
          "Wildfires & Hazards"
        ],
        "summary": "Query Active Satellite Wildfire Incidents",
        "description": "Queries active wildfire perimeters and incident points from the USGS / NIFC WFIGS FeatureServer. Supports geospatial bounding box filtering or returns top active incidents nationwide.",
        "operationId": "getActiveWildfires",
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "-87.0,42.0,-84.0,45.0"
            },
            "description": "Geospatial bounding box in format minLng,minLat,maxLng,maxLat (WGS84 EPSG:4326)."
          },
          {
            "name": "burnType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN_BRUSH_PILE",
                "RECREATIONAL_PIT",
                "BURN_BARREL",
                "AGRICULTURAL_FIELD"
              ],
              "default": "OPEN_BRUSH_PILE"
            },
            "description": "Outdoor burn apparatus evaluated across jurisdictions."
          }
        ],
        "responses": {
          "200": {
            "description": "Active wildfire incidents successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "example": "USGS_NIFC_WFIGS"
                    },
                    "count": {
                      "type": "integer",
                      "example": 12
                    },
                    "wildfires": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "example": "Pine Creek Incident"
                          },
                          "acres": {
                            "type": "number",
                            "example": 145.5
                          },
                          "percentContained": {
                            "type": "integer",
                            "nullable": true,
                            "example": 45
                          },
                          "county": {
                            "type": "string",
                            "example": "Newaygo"
                          },
                          "state": {
                            "type": "string",
                            "example": "MI"
                          },
                          "discoveredAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "lat": {
                            "type": "number",
                            "example": 43.46
                          },
                          "lng": {
                            "type": "number",
                            "example": -85.98
                          }
                        }
                      }
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "tags": [
          "Civic Status"
        ],
        "summary": "Query Open-Burning Status & Micro-Clearances",
        "description": "Evaluates point-coordinate weather, state permits, active wildfires, local emergency orders, and physical site clearances using the deterministic Most-Restrictive-Wins waterfall. Returns GREEN (Allowed), ORANGE (Restricted), RED (Ban Active), or GRAY (Local Rules).",
        "operationId": "getBurnStatus",
        "parameters": [
          {
            "name": "county",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Newaygo"
            },
            "description": "County or parish jurisdiction name. Required unless valid lat and lng coordinates are provided for automatic reverse-geocoding."
          },
          {
            "name": "township",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Brooks"
            },
            "description": "Township, city, or municipality name."
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "MI",
              "example": "MI"
            },
            "description": "Two-letter US state or Canadian province code."
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "US",
              "example": "US"
            },
            "description": "ISO 3166-1 alpha-2 country code."
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "format": "float",
              "example": 43.4144
            },
            "description": "Latitude coordinate for hyper-local NWS/Open-Meteo queries."
          },
          {
            "name": "lng",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "format": "float",
              "example": -85.7958
            },
            "description": "Longitude coordinate for hyper-local NWS/Open-Meteo queries."
          },
          {
            "name": "burnType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN_BRUSH_PILE",
                "RECREATIONAL_PIT",
                "BURN_BARREL",
                "AGRICULTURAL_FIELD"
              ],
              "default": "OPEN_BRUSH_PILE"
            },
            "description": "Type of outdoor fire apparatus."
          },
          {
            "name": "structureSetbackFt",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "example": 50
            },
            "description": "Measured distance in feet from nearest structure."
          },
          {
            "name": "treeSetbackFt",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "example": 30
            },
            "description": "Measured distance in feet from nearest woodland or tree line."
          },
          {
            "name": "waterSource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "HOSE",
                "EXTINGUISHER",
                "WATER_BARREL",
                "NONE"
              ],
              "default": "HOSE"
            },
            "description": "Water suppression available on site prior to ignition."
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es",
                "zh",
                "tl",
                "vi",
                "ar",
                "fr",
                "ko",
                "ru",
                "pt",
                "de",
                "pl",
                "el"
              ],
              "default": "en"
            },
            "description": "Target localization language code."
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative burn status evaluation result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "public with stale-while-revalidate for normal conditions; no-cache for RED emergency bans."
              },
              "X-Burn-Cache-Policy": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "EDGE_REVALIDATE",
                    "BYPASS_EMERGENCY_RED"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BurnStatusResult"
                }
              }
            }
          },
          "400": {
            "description": "Missing required parameters (e.g. county).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "tags": [
          "System Diagnostics"
        ],
        "summary": "Edge & Upstream Service Heartbeat",
        "description": "Runs concurrent upstream probes against Cloudflare D1, NWS Weather API, NIFC Wildfire FeatureServer, and Michigan DNR ArcGIS.",
        "operationId": "getHealthCheck",
        "responses": {
          "200": {
            "description": "Operational health diagnostics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReport"
                }
              }
            }
          }
        }
      }
    },
    "/api/dispatch/webhook": {
      "post": {
        "tags": [
          "CAD & Emergency Dispatch"
        ],
        "summary": "Ingest 911 CAD Callout Incident",
        "description": "Automated webhook for 911 PSAPs and CAD vendors (Tyler New World, CentralSquare, Active911). Instantly enacts a township or county-wide burn ban during active fire operations.",
        "operationId": "ingestCadWebhook",
        "security": [
          {
            "DispatchToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CadWebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Incident processed and emergency order synchronized to edge.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed payload or missing required fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/chief/auth": {
      "post": {
        "tags": [
          "Fire Command (Chief Portal)"
        ],
        "summary": "Authenticate Fire Chief PIN",
        "description": "Authenticates a fire chief mobile PIN with rate-limiting and lockout protection, returning assigned jurisdiction.",
        "operationId": "authChiefPin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pin"
                ],
                "properties": {
                  "pin": {
                    "type": "string",
                    "example": "9911"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChiefAuthResult"
                }
              }
            }
          },
          "401": {
            "description": "Invalid PIN or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Brute force lockout (5 failed attempts in 15 minutes).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/chief/action": {
      "post": {
        "tags": [
          "Fire Command (Chief Portal)"
        ],
        "summary": "Enact or Lift Emergency Burn Ban",
        "description": "Enacts an authoritative emergency burn ban across a township or entire county, broadcasting FCM push alerts to civilians.",
        "operationId": "enactChiefAction",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChiefActionPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Action confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agency/register": {
      "post": {
        "tags": [
          "Municipal B2G Services"
        ],
        "summary": "Enroll Municipal Fire Department",
        "description": "Self-service registration validating FDID and national registry standing. Generates an immediate $1,200 annual municipal invoice and Form W-9.",
        "operationId": "registerAgency",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgencyRegistrationPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Department successfully enrolled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyRegistrationResult"
                }
              }
            }
          }
        }
      }
    },
    "/api/agency/rotate-key": {
      "post": {
        "tags": [
          "Municipal B2G Services"
        ],
        "summary": "Rotate Municipal CAD API Key",
        "description": "Generates a new high-entropy CAD dispatch bearer token and immediately revokes the previous token. Authenticates via current Bearer token or FDID + Chief Authorization PIN.",
        "operationId": "rotateAgencyKey",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fdid": {
                    "type": "string",
                    "example": "41001"
                  },
                  "pin": {
                    "type": "string",
                    "example": "4821"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API key successfully rotated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "fdid": {
                      "type": "string"
                    },
                    "apiKey": {
                      "type": "string",
                      "example": "cad_live_41001_8d25f460ce..."
                    },
                    "keyPrefix": {
                      "type": "string",
                      "example": "cad_live_41001_8"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Invalid current key or PIN."
          }
        }
      }
    },
    "/api/agency/invoice": {
      "get": {
        "tags": [
          "Municipal B2G Services"
        ],
        "summary": "Retrieve Municipal Remittance Voucher",
        "description": "Generates an official Net-30 remittance invoice formatted for city treasurers and county clerk accounts payable (JSON or printable HTML).",
        "operationId": "getAgencyInvoice",
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "INV-2026-41001-OHGG"
            },
            "description": "Invoice voucher number."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "html"
              ],
              "default": "json"
            },
            "description": "Output response format."
          }
        ],
        "responses": {
          "200": {
            "description": "Municipal invoice voucher rendered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceData"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/agency/w9": {
      "get": {
        "tags": [
          "Municipal B2G Services"
        ],
        "summary": "Download Official Form W-9 Verification",
        "description": "Returns official printable Form W-9 Request for Taxpayer Identification Number and Certification with digital signature and EIN for municipal vendor packet compliance.",
        "operationId": "getAgencyW9",
        "responses": {
          "200": {
            "description": "Form W-9 HTML rendered.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/statutes": {
      "get": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "Query State & International Forestry Statutes",
        "description": "Returns statutory codes, citations, daytime burning bans, and seasonal restrictions for a jurisdiction.",
        "operationId": "getStatutes",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "OH"
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "US"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Statutory rules catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ordinances": {
      "get": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "Search Municipal Local Fire Ordinances",
        "description": "Look up township and city open burning ordinances, required setbacks, and permit fee rules.",
        "operationId": "getOrdinances",
        "parameters": [
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "Kent"
            }
          },
          {
            "name": "township",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "Cascade"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Municipal ordinances list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ordinances/fetch-url": {
      "post": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "Fetch or Auto-Discover Municipal Ordinance Text (Native Fetch + Kitesurf Isolate)",
        "description": "SSRF-guarded tiered URL-to-Text ingestion and automatic jurisdiction URL discovery endpoint. Runs native edge fetch() first and falls back to Cloudflare Kitesurf for JS SPA portals, stopping safely on any anti-bot gate.",
        "operationId": "fetchOrdinanceUrlText",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://example.gov/fire-ordinance"
                  },
                  "discover": {
                    "type": "boolean",
                    "default": false,
                    "description": "Automatically discover the official municipal/statutory ordinance URL when url is omitted."
                  },
                  "country": {
                    "type": "string",
                    "default": "US"
                  },
                  "state": {
                    "type": "string",
                    "default": "MI"
                  },
                  "county": {
                    "type": "string"
                  },
                  "municipality": {
                    "type": "string"
                  },
                  "preferKitesurf": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Clean line-preserving ordinance text extracted from supplied or discovered URL."
          },
          "400": {
            "description": "Missing, invalid, or unsafe non-public HTTPS URL."
          },
          "403": {
            "description": "Target portal presented an access control or anti-bot gate."
          },
          "404": {
            "description": "Automatic jurisdiction discovery could not locate a public ordinance page."
          },
          "422": {
            "description": "PDF link, JS SPA without Kitesurf binding, or insufficient extracted text."
          }
        }
      }
    },
    "/api/ordinances/extract": {
      "post": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "AI Municipal Ordinance Ingestion (Gate 1 & Gate 2)",
        "description": "Extracts candidate rules alongside exact verbatim grounding quotes from pasted text or a fetched public URL and verifies against Gate 2 anti-hallucination assertions (NIST AI RMF 1.0).",
        "operationId": "extractOrdinanceCandidate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Raw municipal ordinance text or legal notice."
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Optional public https:// URL to fetch when text is omitted."
                  },
                  "country": {
                    "type": "string",
                    "default": "US"
                  },
                  "state": {
                    "type": "string",
                    "default": "MI"
                  },
                  "county": {
                    "type": "string"
                  },
                  "municipality": {
                    "type": "string"
                  },
                  "citation": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Proposal and Gate 2 verification result."
          }
        }
      }
    },
    "/api/ordinances/commit": {
      "post": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "Cryptographic Human Sign-Off (Gate 3 D1 Commit)",
        "description": "Authenticated Fire Chief or Admin commits a Gate 2-verified ordinance into D1 with FRE 902(14) Merkle-chained audit ledger entry.",
        "operationId": "commitVerifiedOrdinance",
        "security": [
          {
            "ChiefPin": []
          },
          {
            "AdminKey": []
          },
          {
            "DispatchToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sourceText",
                  "proposal"
                ],
                "properties": {
                  "sourceText": {
                    "type": "string"
                  },
                  "proposal": {
                    "type": "object"
                  },
                  "pin": {
                    "type": "string"
                  },
                  "adminKey": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ordinance committed and audit ledger hashed."
          },
          "401": {
            "description": "Unauthorized."
          },
          "422": {
            "description": "Gate 2 verification failed."
          }
        }
      }
    },
    "/api/ordinances/audit-ledger": {
      "get": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "FRE 902(14) Evidentiary Legal Audit Ledger",
        "description": "Cryptographic audit ledger for legal subpoenas and compliance review.",
        "operationId": "getAuditLedger",
        "security": [
          {
            "ChiefPin": []
          },
          {
            "AdminKey": []
          }
        ],
        "parameters": [
          {
            "name": "recordType",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "ORDINANCE_COMMIT"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audit ledger entries with Merkle hashes."
          },
          "401": {
            "description": "Unauthorized."
          }
        }
      }
    },
    "/api/radio": {
      "get": {
        "tags": [
          "Civic Status"
        ],
        "summary": "NOAA Weather Radio All-Hazards Transmitter Directory",
        "description": "Resolves the nearest authoritative NOAA Weather Radio (NWR) transmitter, frequency (162.400-162.550 MHz), live audio stream, and severed-network civil defense guidance.",
        "operationId": "getNoaaRadio",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "MI",
              "example": "MI"
            }
          },
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "Kent"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transmitter metadata, audio stream, and civil safety guidance."
          }
        }
      }
    },
    "/api/chief/status": {
      "get": {
        "tags": [
          "Fire Command (Chief Portal)"
        ],
        "summary": "Query Active Department Emergency Overrides",
        "description": "Retrieves all unexpired emergency burn bans enacted by a department chief or CAD system for a specific county/state.",
        "operationId": "getChiefOverrides",
        "parameters": [
          {
            "name": "county",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Newaygo"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "MI"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active departmental overrides list."
          }
        }
      }
    },
    "/api/chief/audit-log": {
      "get": {
        "tags": [
          "Fire Command (Chief Portal)"
        ],
        "summary": "Export Departmental Action Audit Trail (Header Auth)",
        "description": "Generates an immutable audit trail via X-Chief-Pin and X-Chief-Identifier request headers.",
        "operationId": "getChiefAuditLog",
        "security": [
          {
            "ChiefPin": []
          }
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audit log exported in JSON or CSV format."
          },
          "401": {
            "description": "Unauthorized PIN."
          }
        }
      },
      "post": {
        "tags": [
          "Fire Command (Chief Portal)"
        ],
        "summary": "Export Departmental Action Audit Trail via POST Body",
        "operationId": "postChiefAuditLog",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "identifier",
                  "pin"
                ],
                "properties": {
                  "identifier": {
                    "type": "string"
                  },
                  "pin": {
                    "type": "string"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "csv"
                    ],
                    "default": "json"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audit log exported."
          },
          "401": {
            "description": "Unauthorized PIN."
          }
        }
      }
    },
    "/api/registry/sources": {
      "get": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "List Civic Data Sources and Sync Health",
        "description": "Enumerates national, state, and county registries, scrapers, and telemetry streams powering the engine.",
        "operationId": "getRegistrySources",
        "responses": {
          "200": {
            "description": "Data sources catalog."
          }
        }
      }
    },
    "/api/registry/hierarchy": {
      "get": {
        "tags": [
          "Regulatory Catalog"
        ],
        "summary": "Browse Global Administrative Hierarchy & Statute Sync Coverage",
        "description": "Public read-only drill-down across Continent, Country, Admin1, Admin2, and Admin3 nodes including statute/feed sync coverage and boundary transition history.",
        "operationId": "getRegistryHierarchy",
        "parameters": [
          {
            "name": "parentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Parent node_id to drill into (e.g. CONT-NA, US, US-NM, US-NM-CIBOLA)"
          },
          {
            "name": "tier",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CONTINENT",
                "COUNTRY",
                "ADMIN1",
                "ADMIN2",
                "ADMIN3"
              ]
            }
          },
          {
            "name": "continent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "syncStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "SYNCED",
                "UNSYNCED",
                "STALE",
                "NO_STATUTE_FOUND",
                "ERROR"
              ]
            }
          },
          {
            "name": "boundaryStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "ACTIVE",
                "MERGED",
                "SPLIT",
                "RENAMED",
                "DISSOLVED"
              ],
              "default": "ACTIVE"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Case-insensitive search across node name or external ID"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Global administrative hierarchy nodes and sync coverage summary."
          }
        }
      }
    },
    "/api/v1/partner/account": {
      "get": {
        "tags": [
          "Commercial Partner APIs"
        ],
        "summary": "Verify Partner API Key Tier & Quota Status",
        "description": "Validates an x-api-key or Bearer token against Commercial Partner credentials and returns the active SLA tier, rate-limit policy, and available endpoints.",
        "operationId": "getPartnerAccountStatus",
        "parameters": [
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "demo_partner_preview"
            },
            "description": "Commercial Partner API key via x-api-key or Authorization: Bearer header (omit or pass demo_partner_preview for SANDBOX preview status)"
          }
        ],
        "responses": {
          "200": {
            "description": "Partner tier and SLA status returned successfully."
          },
          "400": {
            "description": "Forbidden apiKey query parameter detected."
          },
          "401": {
            "description": "Invalid or suspended Commercial Partner API key."
          }
        }
      }
    },
    "/api/v1/partner/fire-risk": {
      "get": {
        "tags": [
          "Commercial Partner APIs"
        ],
        "summary": "Commercial Partner Wildfire & Campfire Risk Assessment",
        "description": "Low-latency, deterministic endpoint engineered for outdoor, hunting, and camping apps (e.g. OnX, Gaia GPS, AllTrails). Evaluates coordinates for active burn bans, recreational campfire exemptions, Red Flag warnings, and active wildfires within 15 miles.",
        "operationId": "getPartnerFireRisk",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "example": 44.31
            },
            "description": "Target latitude (WGS84)"
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "example": -85.78
            },
            "description": "Target longitude (WGS84)"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CAMPFIRE_RECREATIONAL",
                "OPEN_BRUSH_PILE",
                "RECREATIONAL_PIT"
              ],
              "default": "CAMPFIRE_RECREATIONAL"
            },
            "description": "Apparatus or fire type"
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "demo_partner_preview"
            },
            "description": "Commercial Partner API key via x-api-key or Authorization: Bearer header (omit or pass demo_partner_preview for rate-limited SANDBOX access)"
          }
        ],
        "responses": {
          "200": {
            "description": "Comprehensive situational outdoor fire risk & regulatory payload."
          },
          "400": {
            "description": "Missing or invalid coordinates, or forbidden apiKey query parameter."
          },
          "401": {
            "description": "Invalid or suspended Commercial Partner API key."
          },
          "429": {
            "description": "Sandbox rate limit exceeded (30 requests per 15 minutes)."
          }
        }
      }
    },
    "/api/fire-stations": {
      "get": {
        "tags": [
          "Wildfires & Hazards"
        ],
        "summary": "Query Nearest Fire Stations & Apparatus Staffing Metadata",
        "description": "Retrieves firehouse coordinates from USGS National Map Structures enriched with USFA staffing classifications within a bounding box or radius.",
        "operationId": "getFireStations",
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "-86.3,43.2,-85.4,43.8"
            },
            "description": "Bounding box minLng,minLat,maxLng,maxLat"
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "example": 43.46
            },
            "description": "Center latitude when bbox is omitted"
          },
          {
            "name": "lng",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "example": -85.94
            },
            "description": "Center longitude when bbox is omitted"
          }
        ],
        "responses": {
          "200": {
            "description": "List of fire stations within the requested spatial envelope."
          }
        }
      }
    },
    "/api/pro/sync": {
      "post": {
        "tags": [
          "Civic Status"
        ],
        "summary": "Cross-Platform Burn Observer Pro SSOT Sync (Web & Android)",
        "description": "Supports REGISTER_OR_SYNC, VERIFY_AND_LOAD, and DELETE_SYNC_DATA to synchronize or permanently purge Burn Observer Pro entitlements and saved burn-site profiles in Cloudflare D1.",
        "operationId": "syncProEntitlement",
        "responses": {
          "200": {
            "description": "Pro entitlement verified and saved sites synchronized."
          },
          "401": {
            "description": "Invalid Account ID or Sync Code."
          }
        }
      }
    },
    "/api/pro/forecast": {
      "get": {
        "tags": [
          "Civic Status"
        ],
        "summary": "48-Hour Safe Burn Window Forecast",
        "description": "Evaluates upcoming 4-hour atmospheric windows over 48 hours while enforcing emergency RED overrides and Zero False Greens.",
        "operationId": "getProBurnWindowForecast",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "example": 42.9634
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "example": -85.6681
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "MI"
            }
          },
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "Kent"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "48-hour burn window evaluation and next safe burn window summary."
          }
        }
      }
    },
    "/api/pro/receipt": {
      "get": {
        "tags": [
          "Civic Status"
        ],
        "summary": "SHA-256 Landowner Burn Compliance Receipt",
        "description": "Generates a printable HTML or JSON evidentiary receipt summarizing observed burn status and physical setback declarations.",
        "operationId": "getProComplianceReceipt",
        "parameters": [
          {
            "name": "county",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "MI"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "GREEN",
                "ORANGE",
                "RED",
                "GRAY"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "html",
                "json"
              ],
              "default": "html"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Landowner compliance receipt rendered in HTML or JSON."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DispatchToken": {
        "type": "apiKey",
        "in": "header",
        "name": "x-dispatch-token",
        "description": "CAD PSAP Authentication Token"
      }
    },
    "schemas": {
      "BurnStatusResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "GREEN",
              "ORANGE",
              "RED",
              "GRAY"
            ],
            "example": "GREEN"
          },
          "canBurn": {
            "type": "boolean",
            "example": true
          },
          "color": {
            "type": "string",
            "example": "#2E7D32"
          },
          "country": {
            "type": "string",
            "example": "US"
          },
          "state": {
            "type": "string",
            "example": "MI"
          },
          "county": {
            "type": "string",
            "example": "Newaygo"
          },
          "township": {
            "type": "string",
            "example": "Brooks"
          },
          "municipalityType": {
            "type": "string",
            "enum": [
              "CITY",
              "VILLAGE",
              "CHARTER_TOWNSHIP",
              "TOWNSHIP"
            ],
            "example": "TOWNSHIP"
          },
          "municipalityLabel": {
            "type": "string",
            "example": "Brooks Twp"
          },
          "fireDistrict": {
            "type": "string",
            "example": "Newaygo Fire Department"
          },
          "nearestFireStation": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "example": "Fremont Fire Department"
              },
              "fdid": {
                "type": "string",
                "example": "23014"
              },
              "address": {
                "type": "string",
                "example": "101 E Main St"
              },
              "city": {
                "type": "string",
                "example": "Fremont"
              },
              "state": {
                "type": "string",
                "example": "MI"
              },
              "zipcode": {
                "type": "string",
                "example": "49412"
              },
              "county": {
                "type": "string",
                "example": "Newaygo"
              },
              "lat": {
                "type": "number",
                "example": 43.4674
              },
              "lng": {
                "type": "number",
                "example": -85.9423
              },
              "distanceMiles": {
                "type": "number",
                "example": 6.1
              },
              "estimatedRoadMiles": {
                "type": "number",
                "example": 7.8
              },
              "estimatedResponseMinutesMin": {
                "type": "integer",
                "example": 17
              },
              "estimatedResponseMinutesMax": {
                "type": "integer",
                "example": 25
              },
              "staffingType": {
                "type": "string",
                "example": "VOLUNTEER"
              },
              "staffingLabel": {
                "type": "string",
                "example": "Volunteer Dept"
              },
              "staffingDescription": {
                "type": "string"
              },
              "populationProtected": {
                "type": "integer",
                "nullable": true,
                "example": 4100
              },
              "coveredSubdivisions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "responseSummary": {
                "type": "string"
              },
              "safetyAdvisory": {
                "type": "string"
              }
            }
          },
          "burnType": {
            "type": "string",
            "example": "OPEN_BRUSH_PILE"
          },
          "lang": {
            "type": "string",
            "example": "en"
          },
          "localizedStatus": {
            "type": "string",
            "nullable": true,
            "example": "BURNING ALLOWED"
          },
          "voiceTts": {
            "type": "string",
            "example": "Burning is allowed today in Brooks Township. Follow standard safety precautions."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "meteo": {
            "type": "object",
            "properties": {
              "temperatureF": {
                "type": "number",
                "example": 68
              },
              "temperatureC": {
                "type": "number",
                "example": 20
              },
              "windSpeed": {
                "type": "number",
                "example": 8.5
              },
              "windGusts": {
                "type": "number",
                "example": 14.2
              },
              "relativeHumidity": {
                "type": "number",
                "example": 45
              },
              "windDirection": {
                "type": "integer",
                "nullable": true,
                "example": 180
              }
            }
          },
          "weather": {
            "type": "object",
            "properties": {
              "temperatureF": {
                "type": "number",
                "example": 68
              },
              "temperatureC": {
                "type": "number",
                "example": 20
              },
              "windSpeed": {
                "type": "number",
                "example": 8.5
              },
              "windGusts": {
                "type": "number",
                "example": 14.2
              },
              "relativeHumidity": {
                "type": "number",
                "example": 45
              },
              "windDirection": {
                "type": "integer",
                "nullable": true,
                "example": 180
              }
            }
          },
          "wildfireThreat": {
            "type": "object",
            "nullable": true,
            "properties": {
              "distanceMiles": {
                "type": "number",
                "example": 6.9
              },
              "cardinalFromSite": {
                "type": "string",
                "example": "S"
              },
              "bearingToFireDeg": {
                "type": "integer",
                "example": 180
              },
              "windFromDeg": {
                "type": "integer",
                "nullable": true,
                "example": 180
              },
              "alignment": {
                "type": "string",
                "enum": [
                  "UPWIND_TOWARD_SITE",
                  "DOWNWIND_MOVING_AWAY",
                  "CROSSWIND",
                  "UNKNOWN_WIND"
                ]
              },
              "label": {
                "type": "string"
              }
            }
          },
          "nextBurnWindow": {
            "type": "object",
            "nullable": true,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "STATUTORY_WINDOW",
                  "WIND_THRESHOLD"
                ]
              },
              "targetWindow": {
                "type": "string",
                "example": "Today after 6:00 PM"
              },
              "summary": {
                "type": "string"
              }
            }
          },
          "siteClearance": {
            "type": "object",
            "properties": {
              "isCompliant": {
                "type": "boolean",
                "example": true
              },
              "structureSetbackFt": {
                "type": "number",
                "example": 50
              },
              "requiredStructureSetbackFt": {
                "type": "number",
                "example": 50
              },
              "treeSetbackFt": {
                "type": "number",
                "example": 30
              },
              "requiredTreeSetbackFt": {
                "type": "number",
                "example": 25
              },
              "waterSource": {
                "type": "string",
                "example": "HOSE"
              }
            }
          },
          "liabilityDisclaimer": {
            "type": "string"
          }
        }
      },
      "CadWebhookPayload": {
        "type": "object",
        "required": [
          "action",
          "county"
        ],
        "properties": {
          "agency": {
            "type": "string",
            "example": "Newaygo Central 911"
          },
          "incidentId": {
            "type": "string",
            "example": "CAD-2026-9911"
          },
          "callType": {
            "type": "string",
            "example": "STRUCTURE_FIRE"
          },
          "action": {
            "type": "string",
            "enum": [
              "BAN",
              "CLEAR"
            ],
            "example": "BAN"
          },
          "state": {
            "type": "string",
            "default": "MI",
            "example": "MI"
          },
          "county": {
            "type": "string",
            "example": "Newaygo"
          },
          "township": {
            "type": "string",
            "default": "ALL",
            "example": "Brooks"
          },
          "durationHours": {
            "type": "number",
            "default": 12,
            "example": 8
          },
          "description": {
            "type": "string",
            "example": "Working structure fire. Mutual aid deployed."
          }
        }
      },
      "ChiefAuthResult": {
        "type": "object",
        "properties": {
          "authenticated": {
            "type": "boolean",
            "example": true
          },
          "name": {
            "type": "string",
            "example": "Chief Dan Miller"
          },
          "jurisdiction": {
            "type": "string",
            "example": "Fremont Fire Department"
          },
          "state": {
            "type": "string",
            "example": "MI"
          },
          "county": {
            "type": "string",
            "example": "Newaygo"
          },
          "townships": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "Fremont",
              "Sheridan",
              "Dayton"
            ]
          }
        }
      },
      "ChiefActionPayload": {
        "type": "object",
        "required": [
          "pin",
          "action",
          "county"
        ],
        "properties": {
          "pin": {
            "type": "string",
            "example": "9911"
          },
          "action": {
            "type": "string",
            "enum": [
              "BAN",
              "CLEAR"
            ],
            "example": "BAN"
          },
          "county": {
            "type": "string",
            "example": "Newaygo"
          },
          "township": {
            "type": "string",
            "default": "ALL",
            "example": "ALL"
          },
          "reason": {
            "type": "string",
            "example": "Severe sudden wind gusts and multiple brush fires reported."
          },
          "durationHours": {
            "type": "number",
            "default": 24,
            "example": 12
          }
        }
      },
      "AgencyRegistrationPayload": {
        "type": "object",
        "required": [
          "agencyName",
          "fdid",
          "chiefName",
          "contactEmail",
          "phone",
          "state",
          "county"
        ],
        "properties": {
          "agencyName": {
            "type": "string",
            "example": "Grand Rapids Fire Department"
          },
          "fdid": {
            "type": "string",
            "example": "41001"
          },
          "chiefName": {
            "type": "string",
            "example": "John Miller"
          },
          "contactEmail": {
            "type": "string",
            "format": "email",
            "example": "chief@grfd.gov"
          },
          "phone": {
            "type": "string",
            "example": "616-555-0100"
          },
          "state": {
            "type": "string",
            "example": "MI"
          },
          "county": {
            "type": "string",
            "example": "Kent"
          },
          "billingAddress": {
            "type": "string",
            "example": "38 LaGrave Ave SE, Grand Rapids, MI 49503"
          }
        }
      },
      "AgencyRegistrationResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string"
          },
          "invoiceNumber": {
            "type": "string",
            "example": "INV-2026-41001-OHGG"
          },
          "invoiceUrl": {
            "type": "string",
            "example": "https://burn.observer/api/agency/invoice?number=INV-2026-41001-OHGG&format=html"
          },
          "w9Url": {
            "type": "string",
            "example": "https://burn.observer/api/agency/w9"
          },
          "annualFeeUsd": {
            "type": "number",
            "example": 1200
          }
        }
      },
      "InvoiceData": {
        "type": "object",
        "properties": {
          "invoiceNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "dueDate": {
            "type": "string"
          },
          "agencyName": {
            "type": "string"
          },
          "fdid": {
            "type": "string"
          },
          "subtotal": {
            "type": "number",
            "example": 1200
          },
          "total": {
            "type": "number",
            "example": 1200
          },
          "remitTo": {
            "type": "object",
            "properties": {
              "vendor": {
                "type": "string"
              },
              "bankName": {
                "type": "string"
              },
              "accountNumber": {
                "type": "string"
              }
            }
          }
        }
      },
      "HealthReport": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "OPERATIONAL"
          },
          "timestamp": {
            "type": "string"
          },
          "edgeColo": {
            "type": "string",
            "example": "ORD"
          },
          "checks": {
            "type": "object"
          }
        }
      },
      "ActionResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "status": {
            "type": "number"
          }
        }
      }
    }
  }
}