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

const store = (set) => ({
  value: 0,
  range: [-25, 18],

  setValue: (value) => {
    set((state) => {
      state.value = value;
    });
  },

  clear: () =>
    set((state) => {
      state.value = 0;
    }),
});

export const useWeatherFilter = create(
  persist(immer(store), { name: "weather-filter" })
);
