{
  "openapi": "3.1.0",
  "info": {
    "title": "City of Underton Open Data API (DEMO — fictional)",
    "version": "1.0.0",
    "description": "DEMONSTRATION ONLY. Fictional building-permit dataset for the fictional City of Underton, TX. Not an official government source. Built by Lowboy Digital LLC as an engineering showcase.",
    "contact": {
      "name": "Lowboy Digital LLC",
      "url": "https://lowboydigital.com"
    },
    "license": {
      "name": "Demo data — CC0 (fictional)"
    }
  },
  "servers": [
    {
      "url": "https://open-data.lowboydigital.com"
    },
    {
      "url": "https://gov-open-data-demo.lowboydigital.workers.dev"
    }
  ],
  "paths": {
    "/api/v1/permits": {
      "get": {
        "summary": "List building permits",
        "operationId": "listPermits",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "in_review | issued | finaled | expired",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Permit type",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ward",
            "in": "query",
            "required": false,
            "description": "e.g. Ward 3",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Issued on/after (YYYY-MM-DD)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "description": "Issued on/before (YYYY-MM-DD)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Full-text search: address, description, contractor",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_valuation",
            "in": "query",
            "required": false,
            "description": "Minimum valuation USD",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1–100, default 50",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Default 0",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permit list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Permit"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permits/{id}": {
      "get": {
        "summary": "Get one permit",
        "operationId": "getPermit",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "BP-2026-0103"
          }
        ],
        "responses": {
          "200": {
            "description": "Permit",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Permit"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/v1/permits/stats": {
      "get": {
        "summary": "Aggregate counts by status, type, ward",
        "operationId": "permitStats",
        "responses": {
          "200": {
            "description": "Stats"
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "summary": "Health check",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Permit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "BP-2026-0101"
          },
          "issued_date": {
            "type": "string",
            "format": "date"
          },
          "type": {
            "type": "string",
            "enum": [
              "residential_new",
              "residential_remodel",
              "commercial_new",
              "commercial_remodel",
              "roofing",
              "fence",
              "pool",
              "demolition",
              "solar",
              "accessory_structure",
              "sign"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_review",
              "issued",
              "finaled",
              "expired"
            ]
          },
          "address": {
            "type": "string"
          },
          "ward": {
            "type": "string",
            "example": "Ward 1"
          },
          "description": {
            "type": "string"
          },
          "valuation_usd": {
            "type": "integer"
          },
          "contractor": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "fictional": {
            "type": "boolean"
          }
        }
      }
    }
  }
}