import { create } from 'zustand'; export interface DeviceUser { ip: string; mac: string; hostname: string; vendor: string; open_ports: string[]; status: string; last_seen: string; note: string; } export interface WifiNetworkScanner { ssid: string; bssid: string; channel: number; signal: number; encryption: string; frequency: string; vendor: string; hidden: boolean; note: string; } interface NetworkStore { devices: DeviceUser[]; setDevices: (devices: DeviceUser[]) => void; addDevice: (device: DeviceUser) => void; wifiNetworks: WifiNetworkScanner[]; setWifiNetworks: (networks: WifiNetworkScanner[]) => void; addWifiNetwork: (network: WifiNetworkScanner) => void; clearAll: () => void; } const useNetworkStore = create((set) => ({ devices: [], setDevices: (devices) => set({ devices }), addDevice: (device) => set((state) => ({ devices: [...state.devices, device] })), wifiNetworks: [], setWifiNetworks: (networks) => set({ wifiNetworks: networks }), addWifiNetwork: (network) => set((state) => ({ wifiNetworks: [...state.wifiNetworks, network] })), clearAll: () => set({ devices: [], wifiNetworks: [] }) })); export default useNetworkStore;