import { create } from "zustand";
import { persist } from "zustand/middleware";

interface SettingsState {
  killSwitch: boolean;
  stealthMode: boolean;
  excludedApps: string[];
  excludedDomains: string[];
  reduceMotion: boolean;
  setKillSwitch: (val: boolean) => void;
  setExcludedApps: (apps: string[]) => void;
  setExcludedDomains: (domains: string[]) => void;
  setReduceMotion: (val: boolean) => void;
}

export const useSettingsStore = create<SettingsState>()(
  persist(
    (set) => ({
      killSwitch: false,
      stealthMode: true,
      excludedApps: [],
      excludedDomains: [],
      reduceMotion: false,
      setKillSwitch: (val) => set({ killSwitch: val }),
      setExcludedApps: (val) => set({ excludedApps: val }),
      setExcludedDomains: (val) => set({ excludedDomains: val }),
      setReduceMotion: (val) => set({ reduceMotion: val }),
    }),
    {
      name: "netrunner-settings", // ключ в localStorage
    },
  ),
);
