{
  "openapi": "3.1.0",
  "info": {
    "title": "crosbynews.com Weather API",
    "version": "1.0.0",
    "description": "Current conditions, hourly and 7-day forecast, and active alerts for Crosby, Texas, sourced from the U.S. National Weather Service. Public, no authentication.",
    "contact": {
      "url": "https://crosbynews.com/"
    },
    "license": {
      "name": "Public domain (NWS source data)",
      "url": "https://www.weather.gov/disclaimer"
    }
  },
  "servers": [
    {
      "url": "https://crosbynews.com"
    }
  ],
  "paths": {
    "/api/weather": {
      "get": {
        "operationId": "getWeather",
        "summary": "Current conditions, forecast, and alerts for Crosby, TX",
        "responses": {
          "200": {
            "description": "Weather snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Weather"
                }
              }
            }
          },
          "502": {
            "description": "Upstream (NWS) unavailable"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health and cache freshness",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "updated": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Weather": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string"
          },
          "coordinates": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            }
          },
          "source": {
            "type": "string"
          },
          "updated": {
            "type": "string",
            "format": "date-time"
          },
          "current": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "number": {
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "isDaytime": {
                    "type": "boolean"
                  },
                  "temperature": {
                    "type": "number"
                  },
                  "temperatureUnit": {
                    "type": "string"
                  },
                  "temperatureTrend": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "shortForecast": {
                    "type": "string"
                  },
                  "windSpeed": {
                    "type": "string"
                  },
                  "windDirection": {
                    "type": "string"
                  },
                  "windGust": {
                    "type": "string"
                  },
                  "probabilityOfPrecipitation": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": [
                          "number",
                          "null"
                        ]
                      }
                    }
                  },
                  "icon": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "hourly": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "number": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "startTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "endTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "isDaytime": {
                  "type": "boolean"
                },
                "temperature": {
                  "type": "number"
                },
                "temperatureUnit": {
                  "type": "string"
                },
                "temperatureTrend": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "shortForecast": {
                  "type": "string"
                },
                "windSpeed": {
                  "type": "string"
                },
                "windDirection": {
                  "type": "string"
                },
                "windGust": {
                  "type": "string"
                },
                "probabilityOfPrecipitation": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  }
                },
                "icon": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "forecast": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "number": {
                  "type": "integer"
                },
                "startTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "endTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "name": {
                  "type": "string"
                },
                "isDaytime": {
                  "type": "boolean"
                },
                "temperature": {
                  "type": "number"
                },
                "temperatureUnit": {
                  "type": "string"
                },
                "shortForecast": {
                  "type": "string"
                },
                "detailedForecast": {
                  "type": "string"
                },
                "windSpeed": {
                  "type": "string"
                },
                "windDirection": {
                  "type": "string"
                },
                "probabilityOfPrecipitation": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  }
                },
                "icon": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "alerts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "event": {
                  "type": "string"
                },
                "headline": {
                  "type": "string"
                },
                "severity": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "instruction": {
                  "type": "string"
                },
                "expires": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          }
        }
      },
      "HourlyPeriod": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "number": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "isDaytime": {
            "type": "boolean"
          },
          "temperature": {
            "type": "number"
          },
          "temperatureUnit": {
            "type": "string"
          },
          "temperatureTrend": {
            "type": [
              "string",
              "null"
            ]
          },
          "shortForecast": {
            "type": "string"
          },
          "windSpeed": {
            "type": "string"
          },
          "windDirection": {
            "type": "string"
          },
          "windGust": {
            "type": "string"
          },
          "probabilityOfPrecipitation": {
            "type": "object",
            "properties": {
              "value": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "icon": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Period": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "number": {
            "type": "integer"
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "isDaytime": {
            "type": "boolean"
          },
          "temperature": {
            "type": "number"
          },
          "temperatureUnit": {
            "type": "string"
          },
          "shortForecast": {
            "type": "string"
          },
          "detailedForecast": {
            "type": "string"
          },
          "windSpeed": {
            "type": "string"
          },
          "windDirection": {
            "type": "string"
          },
          "probabilityOfPrecipitation": {
            "type": "object",
            "properties": {
              "value": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "icon": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Alert": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "instruction": {
            "type": "string"
          },
          "expires": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}