import { type NotificationPreferences, type NotificationWidgetKey } from "./notification-preferences.js"; export interface LocalSafeEnvelope { generatedAt: string; localOnly: true; secretsReturned: false; } export type ViewModelHealthStatus = "ok" | "degraded" | "down" | "unknown"; export type ViewModelRiskSeverity = "info" | "warning" | "critical"; export interface ViewModelProviderRecord { key: string; displayName: string; } export interface ViewModelUsageSnapshotRecord { providerKey: string; collectedAt: string; service: string; metric: string; unit: string; value: number; } export interface ViewModelBillingSnapshotRecord { providerKey: string; collectedAt: string; amountMinor: number; currency: string; status: string; } export interface ViewModelServiceHealthSnapshotRecord { providerKey: string; collectedAt: string; service: string; status: ViewModelHealthStatus; region?: string; message?: string; } export interface ViewModelCostEstimateRecord { providerKey: string; collectedAt: string; estimatedAmountMinor: number; currency: string; confidence: "low" | "medium" | "high"; } export interface ViewModelAlertRecord { providerKey?: string; createdAt: string; severity: ViewModelRiskSeverity; category: string; title: string; message: string; } export interface ViewModelStore { providers: readonly ViewModelProviderRecord[]; usageSnapshots: readonly ViewModelUsageSnapshotRecord[]; billingSnapshots: readonly ViewModelBillingSnapshotRecord[]; serviceHealthSnapshots: readonly ViewModelServiceHealthSnapshotRecord[]; costEstimates: readonly ViewModelCostEstimateRecord[]; alerts: readonly ViewModelAlertRecord[]; } export type ViewModelReadStore = () => Promise; export interface OperationsOverview extends LocalSafeEnvelope { source: "sqlite" | "empty"; summary: { providerCount: number; connectedProviderCount: number; totalEstimatedAmountMinor: number; totalBillingAmountMinor: number; currency: string; usageSnapshotCount: number; costEstimateCount: number; alertCount: number; criticalAlertCount: number; healthStatus: ViewModelHealthStatus; }; providers: readonly OperationsOverviewProvider[]; alerts: readonly OperationsOverviewAlert[]; } export interface OperationsOverviewProvider { providerKey: string; displayName: string; estimatedAmountMinor: number; billingAmountMinor: number; currency: string; usageSnapshotCount: number; costEstimateCount: number; latestCollectedAt: string | null; healthStatus: ViewModelHealthStatus; riskLevel: "low" | "warning" | "critical"; alertCount: number; } export interface OperationsOverviewAlert { providerKey: string | null; displayName: string | null; severity: ViewModelRiskSeverity; category: string; title: string; message: string; createdAt: string; } export interface TodayLiveView extends LocalSafeEnvelope { timezone: string; dateKey: string; cacheState: "empty" | "fresh" | "stale"; summary: { providerCount: number; includedProviderCount: number; todayLiveAmountMinor: number | null; currency: string; }; providers: readonly TodayLiveProviderView[]; } export interface TodayLiveProviderInput { providerKey: string; displayName: string; checkedAt: string | null; expiresAt?: string | null; ttlSeconds?: number; lastAttemptAt?: string | null; lastSuccessAt?: string | null; freshUntil?: string | null; staleUntil?: string | null; lastRefreshFailed?: boolean; revision?: number; message?: string; freshness: "live" | "stale" | "error" | "unavailable" | "not_configured" | "locked"; confidence: "high" | "medium" | "low" | "none"; todayLiveAmountMinor: number | null; currency: string; included: boolean; metrics?: readonly TodayLiveMetric[]; } export interface TodayLiveProviderView extends TodayLiveProviderInput { metrics: readonly TodayLiveMetric[]; } export interface TodayLiveMetric { key: string; value: number; unit: string; resetAt?: string; resetAtLatest?: string; itemKey?: string; accuracy?: "exact" | "estimated" | "bounded" | "unknown"; source?: string; } export interface NotificationDigest extends LocalSafeEnvelope { title: string; status: "ok" | "attention" | "critical"; suppressedReason: string | null; items: readonly NotificationDigestItem[]; } export interface NotificationDigestItem { widgetKey: NotificationWidgetKey; kind: "summary" | "live" | "risk" | "usage" | "health"; severity: ViewModelRiskSeverity; label: string; value: string; numericValue?: number; unit?: string; usedPercent?: number; remainingPercent?: number; thresholdTriggered?: boolean; thresholdCooldownMinutes?: number; resetAt?: string; resetAtLatest?: string; providerKey?: string; accuracy?: "exact" | "estimated" | "bounded" | "unknown"; freshness?: TodayLiveProviderView["freshness"]; confidence?: TodayLiveProviderView["confidence"]; clickPath?: string; } export interface TrayMenuModel extends LocalSafeEnvelope { title: string; subtitle: string; status: "ok" | "attention" | "critical"; items: readonly TrayMenuItem[]; } export interface TrayMenuItem { id: string; label: string; enabled: boolean; kind: "command" | "separator" | "status"; action?: string; urlPath?: string; durationMinutes?: number; } export interface ReadOperationsOverviewOptions { now?: () => Date; store?: ViewModelStore; readStore?: ViewModelReadStore; } export interface ReadTodayLiveViewOptions extends ReadOperationsOverviewOptions { timezone?: string; liveProviders?: readonly TodayLiveProviderInput[]; } export interface ReadNotificationDigestOptions extends ReadTodayLiveViewOptions { overview?: OperationsOverview; todayLive?: TodayLiveView; notificationPreferences?: NotificationPreferences; } export interface ReadTrayMenuModelOptions extends ReadNotificationDigestOptions { digest?: NotificationDigest; } export declare function readOperationsOverview(options?: ReadOperationsOverviewOptions): Promise; export declare function buildOperationsOverview(store: ViewModelStore, options: { generatedAt: string; }): OperationsOverview; export declare function readTodayLiveView(options?: ReadTodayLiveViewOptions): Promise; export declare function buildTodayLiveView(store: ViewModelStore, options: { generatedAt: string; now: Date; timezone: string; liveProviders?: readonly TodayLiveProviderInput[]; }): TodayLiveView; export declare function readNotificationDigest(options?: ReadNotificationDigestOptions): Promise; export declare function buildNotificationDigest(overview: OperationsOverview, todayLive: TodayLiveView, preferences?: NotificationPreferences): NotificationDigest; export declare function readTrayMenuModel(options?: ReadTrayMenuModelOptions): Promise; export declare function buildTrayMenuModel(digest: NotificationDigest): TrayMenuModel; //# sourceMappingURL=view-model.d.ts.map