import { create } from 'zustand' import type { Stats } from '@/lib/types' interface EngineState { status: 'Idle' | 'Running' | 'Paused' uptime_seconds: number total_scanned: number total_alerts: number last_cycle: string isOffline: boolean setStats: (stats: Stats) => void setOffline: (offline: boolean) => void } export const useEngineStore = create((set) => ({ status: 'Idle', uptime_seconds: 0, total_scanned: 0, total_alerts: 0, last_cycle: 'Never', isOffline: false, setStats: (stats) => set({ status: stats.engine_status, uptime_seconds: stats.uptime_seconds, total_scanned: stats.total_scanned, total_alerts: stats.total_alerts, last_cycle: stats.last_cycle, isOffline: false, }), setOffline: (offline) => set({ isOffline: offline }), }))