import { Socket } from "socket.io-client";
import { create } from "zustand";
import { devtools } from "zustand/middleware";

interface SocketState {
  socket: Socket | null;
  setSocket: (socket: Socket | null) => void;
}

const useSocketStore = create<SocketState>()(
  devtools((set) => ({
    socket: null,
    setSocket: (socket) => set({ socket }),
  }))
);

export default useSocketStore;
