▍ humdrum codex / soft
872 B raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { z } from "zod";

// Air quality + pollen for a location (Open-Meteo air-quality API, keyless).
// Location resolves from config → app settings → env, same as weather.
export const AqiConfig = z.object({
  lat: z.number().optional(),
  lon: z.number().optional(),
  label: z.string().optional(),
});
export type AqiConfig = z.infer<typeof AqiConfig>;

export const AqiPollen = z.object({
  label: z.string(),
  value: z.number(), // grains/m³
  level: z.string(), // Low / Moderate / High / Very High
});

export const AqiPayload = z.object({
  location: z.string(),
  aqi: z.number().nullable(), // US AQI
  category: z.string(), // Good / Moderate / Unhealthy …
  pm25: z.number().nullable(),
  pm10: z.number().nullable(),
  ozone: z.number().nullable(),
  pollen: z.array(AqiPollen).default([]),
});
export type AqiPayload = z.infer<typeof AqiPayload>;