/** @format */

import { defineStore } from 'pinia'
import { useUserStore } from './user'

export const useCommonStore = defineStore(
  'commonStore',
  () => {
    const navigateTextColor = ref('#ffffff')
    const navigateBgColor = ref('#0F0820')
    // const userStore = useUserStore()

    const setNavigateBgColor = (color: string) => {
      if (!color)
        return
      color = color.toUpperCase()
      if (color === '#0F0820') {
        navigateTextColor.value = '#ffffff'
        navigateBgColor.value = 'rgba(15,8,32, 0.7)'
      }
      else if (color === '#F3F4FB') {
        navigateTextColor.value = '#0F0820'
        navigateBgColor.value = 'rgba(243,244,251, 0.7)'
      }
      else if (color === '#FFFFFF') {
        navigateTextColor.value = '#0F0820'
        navigateBgColor.value = 'rgba(255, 255, 255, 0.7)'
      }
    }

    return {
      navigateTextColor,
      navigateBgColor,
      setNavigateBgColor,
    }
  },
  {
    persist: true,
  },
)
