/**
 * This file is part of the SplendidBear Websites' projects.
 *
 * Copyright (c) 2026 @ www.splendidbear.org
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import { useState } from 'react';
import { initCells, PLAYER_DEF } from '@mine-utils';

const useGameState = () => {
  const [webPlayer, setWebPlayer] = useState(null);
  const [activePlayer, setActivePlayer] = useState(false);
  const [overlay, setOverlay] = useState(true);
  const [overlayTitle, setOverlayTitle] = useState('');
  const [overlaySubTitle, setOverlaySubTitle] = useState('');
  const [mines, setMines] = useState(51);
  const [bombSelected, setBombSelected] = useState(false);
  const [foundMines, setFoundMines] = useState(false);
  const [red, setRed] = useState({ ...PLAYER_DEF });
  const [blue, setBlue] = useState({ ...PLAYER_DEF });
  const [cells, setCells] = useState(initCells);
  const [gridReady, setGridReady] = useState(false);
  const [connectionLost, setConnectionLost] = useState(false);

  return {
    webPlayer, setWebPlayer,
    activePlayer, setActivePlayer,
    overlay, setOverlay,
    overlayTitle, setOverlayTitle,
    overlaySubTitle, setOverlaySubTitle,
    mines, setMines,
    bombSelected, setBombSelected,
    foundMines, setFoundMines,
    red, setRed,
    blue, setBlue,
    cells, setCells,
    gridReady, setGridReady,
    connectionLost, setConnectionLost,
  };
};

export default useGameState;
