{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "weather-utils",
  "type": "registry:lib",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/lib/weather-utils.tsx",
      "content": "import {\n  CloudFogIcon,\n  CloudLightningIcon,\n  CloudRainIcon,\n  CloudSunIcon,\n  SnowflakeIcon,\n  SunIcon,\n} from \"lucide-react\";\nimport type { JSX } from \"react\";\n\nexport enum WeatherCode {\n  // Clear\n  CLEAR_SKY = 0,\n  MAINLY_CLEAR = 1,\n  PARTLY_CLOUDY = 2,\n  OVERCAST = 3,\n\n  // Fog\n  FOG = 45,\n  DEPOSITING_RIME_FOG = 48,\n\n  // Drizzle\n  DRIZZLE_LIGHT = 51,\n  DRIZZLE_MODERATE = 53,\n  DRIZZLE_DENSE = 55,\n\n  // Freezing Drizzle\n  FREEZING_DRIZZLE_LIGHT = 56,\n  FREEZING_DRIZZLE_DENSE = 57,\n\n  // Rain\n  RAIN_SLIGHT = 61,\n  RAIN_MODERATE = 63,\n  RAIN_HEAVY = 65,\n\n  // Freezing Rain\n  FREEZING_RAIN_LIGHT = 66,\n  FREEZING_RAIN_HEAVY = 67,\n\n  // Snow\n  SNOW_FALL_SLIGHT = 71,\n  SNOW_FALL_MODERATE = 73,\n  SNOW_FALL_HEAVY = 75,\n  SNOW_GRAINS = 77,\n\n  // Rain Showers\n  RAIN_SHOWERS_SLIGHT = 80,\n  RAIN_SHOWERS_MODERATE = 81,\n  RAIN_SHOWERS_VIOLENT = 82,\n\n  // Snow Showers\n  SNOW_SHOWERS_SLIGHT = 85,\n  SNOW_SHOWERS_HEAVY = 86,\n\n  // Thunderstorm\n  THUNDERSTORM_SLIGHT_MODERATE = 95,\n  THUNDERSTORM_HAIL_SLIGHT = 96,\n  THUNDERSTORM_HAIL_HEAVY = 99,\n}\n\nexport function getWeatherIcon(\n  code: number,\n  size: string = \"size-16\",\n  props: Record<string, string | number> = {},\n): JSX.Element {\n  if (code === WeatherCode.CLEAR_SKY)\n    return <SunIcon className={size + \" stroke-amber-300\"} {...props} />;\n\n  if (code >= WeatherCode.MAINLY_CLEAR && code <= WeatherCode.OVERCAST)\n    return <CloudSunIcon className={size + \" stroke-gray-400\"} {...props} />;\n\n  if (code >= WeatherCode.FOG && code <= WeatherCode.DEPOSITING_RIME_FOG)\n    return <CloudFogIcon className={size + \" stroke-gray-400\"} {...props} />;\n\n  if (\n    code >= WeatherCode.DRIZZLE_LIGHT &&\n    code <= WeatherCode.FREEZING_RAIN_HEAVY\n  )\n    return <CloudRainIcon className={size + \" stroke-blue-400\"} {...props} />;\n\n  if (code >= WeatherCode.SNOW_FALL_SLIGHT && code <= WeatherCode.SNOW_GRAINS)\n    return <SnowflakeIcon className={size + \" stroke-blue-200\"} {...props} />;\n\n  if (\n    code >= WeatherCode.RAIN_SHOWERS_SLIGHT &&\n    code <= WeatherCode.RAIN_SHOWERS_VIOLENT\n  )\n    return <CloudRainIcon className={size + \" stroke-blue-500\"} {...props} />;\n\n  if (\n    code >= WeatherCode.THUNDERSTORM_SLIGHT_MODERATE &&\n    code <= WeatherCode.THUNDERSTORM_HAIL_HEAVY\n  )\n    return (\n      <CloudLightningIcon className={size + \" stroke-purple-500\"} {...props} />\n    );\n\n  return <SunIcon className={size + \" stroke-amber-300\"} {...props} />;\n}\n\nexport function getSmallWeatherIcon(code: number): JSX.Element {\n  if (code === WeatherCode.CLEAR_SKY)\n    return <SunIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (code >= WeatherCode.MAINLY_CLEAR && code <= WeatherCode.OVERCAST)\n    return <CloudSunIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (code >= WeatherCode.FOG && code <= WeatherCode.DEPOSITING_RIME_FOG)\n    return <CloudFogIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (\n    code >= WeatherCode.DRIZZLE_LIGHT &&\n    code <= WeatherCode.FREEZING_RAIN_HEAVY\n  )\n    return <CloudRainIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (code >= WeatherCode.SNOW_FALL_SLIGHT && code <= WeatherCode.SNOW_GRAINS)\n    return <SnowflakeIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (\n    code >= WeatherCode.RAIN_SHOWERS_SLIGHT &&\n    code <= WeatherCode.RAIN_SHOWERS_VIOLENT\n  )\n    return <CloudRainIcon className=\"stroke-muted-foreground size-6\" />;\n\n  if (\n    code >= WeatherCode.THUNDERSTORM_SLIGHT_MODERATE &&\n    code <= WeatherCode.THUNDERSTORM_HAIL_HEAVY\n  )\n    return <CloudLightningIcon className=\"stroke-muted-foreground size-6\" />;\n\n  return <SunIcon className=\"stroke-muted-foreground size-6\" />;\n}\n\nexport function getWeatherDescription(code: number): string {\n  if (code === WeatherCode.CLEAR_SKY) return \"Clear Sky\";\n\n  if (code >= WeatherCode.MAINLY_CLEAR && code <= WeatherCode.OVERCAST)\n    return \"Partly Cloudy\";\n\n  if (code >= WeatherCode.FOG && code <= WeatherCode.DEPOSITING_RIME_FOG)\n    return \"Foggy\";\n\n  if (\n    code >= WeatherCode.DRIZZLE_LIGHT &&\n    code <= WeatherCode.FREEZING_RAIN_HEAVY\n  )\n    return \"Rainy\";\n\n  if (code >= WeatherCode.SNOW_FALL_SLIGHT && code <= WeatherCode.SNOW_GRAINS)\n    return \"Snowy\";\n\n  if (\n    code >= WeatherCode.RAIN_SHOWERS_SLIGHT &&\n    code <= WeatherCode.RAIN_SHOWERS_VIOLENT\n  )\n    return \"Heavy Rain\";\n\n  if (\n    code >= WeatherCode.THUNDERSTORM_SLIGHT_MODERATE &&\n    code <= WeatherCode.THUNDERSTORM_HAIL_HEAVY\n  )\n    return \"Thunderstorm\";\n\n  return \"Clear Sky\";\n}\n",
      "type": "registry:lib"
    }
  ]
}