import isBoolean from 'lodash/isBoolean'

import { useLocalStore } from 'hooks'

const SCORE_KEY = 'score_hidden'

export const useMatchSwitches = () => {
  const [isScoreHidden, setScoreHidden] = useLocalStore({
    defaultValue: false,
    key: SCORE_KEY,
    validator: isBoolean,
  })
  const toggleScore = () => setScoreHidden(!isScoreHidden)

  return {
    isScoreHidden,
    toggleScore,
  }
}
