import { z } from "zod"; // App-wide settings, stored as key/value JSON rows. Known keys are typed below; // unknown keys are allowed (forward-compatible). export const Location = z.object({ label: z.string().default(""), lat: z.number(), lon: z.number(), }); export type Location = z.infer; export const Settings = z.object({ location: Location.nullable().default(null), units: z.enum(["metric", "imperial"]).default("imperial"), // ordered list of source ids for the dashboard grid; empty = use Source.position layout: z.array(z.string()).default([]), }); export type Settings = z.infer; export const SETTINGS_DEFAULTS: Settings = { location: { label: "Napa, CA", lat: 38.2975, lon: -122.2869 }, units: "imperial", layout: [], }; // One row in the settings table. export const SettingRow = z.object({ key: z.string(), value: z.unknown(), }); export type SettingRow = z.infer;