54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
export type WeatherRegion = "PL" | "GLOBAL";
|
|
|
|
export type WeatherSource = "IMGW" | "ALARO" | "OPEN_METEO";
|
|
|
|
export type WeatherSourceType = "observation" | "model" | "hybrid" | "official_warning";
|
|
|
|
export interface WeatherCapabilities {
|
|
current: boolean;
|
|
forecastHourly: boolean;
|
|
forecastDaily: boolean;
|
|
officialWarnings: boolean;
|
|
countyFiltering: boolean;
|
|
brief: boolean;
|
|
pushOfficialAlerts: boolean;
|
|
}
|
|
|
|
export interface WeatherSourceMetadata {
|
|
source: WeatherSource;
|
|
sourceLabel: string;
|
|
sourceType: WeatherSourceType;
|
|
isOfficial: boolean;
|
|
fetchedAt?: string;
|
|
generatedAt?: string;
|
|
}
|
|
|
|
export const WEATHER_CAPABILITIES: Record<WeatherRegion, WeatherCapabilities> = {
|
|
PL: {
|
|
current: true,
|
|
forecastHourly: true,
|
|
forecastDaily: true,
|
|
officialWarnings: true,
|
|
countyFiltering: true,
|
|
brief: true,
|
|
pushOfficialAlerts: true,
|
|
},
|
|
GLOBAL: {
|
|
current: true,
|
|
forecastHourly: true,
|
|
forecastDaily: true,
|
|
officialWarnings: false,
|
|
countyFiltering: false,
|
|
brief: true,
|
|
pushOfficialAlerts: false,
|
|
},
|
|
};
|
|
|
|
export function getWeatherRegionForCountryCode(countryCode?: string | null): WeatherRegion {
|
|
return countryCode?.trim().toUpperCase() === "PL" ? "PL" : "GLOBAL";
|
|
}
|
|
|
|
export function getWeatherCapabilities(region?: WeatherRegion | null) {
|
|
return WEATHER_CAPABILITIES[region ?? "PL"];
|
|
}
|