import type { Socket } from 'socket.io-client';
import { create } from 'zustand';

type SocketState = {
  socket: Socket | null;
  isConnected: boolean;
  setSocket: (socket: Socket | null) => void;
  setConnected: (isConnected: boolean) => void;
};

export const useSocketStore = create<SocketState>((set) => ({
  socket: null,
  isConnected: false,

  setSocket: (socket) => {
    set({ socket });
  },
  setConnected: (isConnected) => {
    set({ isConnected });
  },
}));
