export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref<any | null>(null)
    // const token = useCookie('authentication')

    const isAuthenticated = computed(() => !!user.value)
    // const userRole = computed(() => user.value?.user_position_code || '')

    const login = async (userData: any) => {
      user.value = userData
    }

    const logout = () => {
      user.value = null
    }

    return {
      user,
      isAuthenticated,
      userRole: ['doctor'],
      login,
      logout,
    }
  },
  {
    persist: {
      key: 'user',
      pick: ['user'],
    },
  },
)
