import { defineStore } from 'pinia'
import { ref } from 'vue'

/** Signals that we just logged in - Dashboard uses this for zoom + oomph */
export const useLoginTransitionStore = defineStore('loginTransition', () => {
  const justLoggedIn = ref(false)
  /** Show empty welcome block until typing starts (hide static text) */
  const pendingWelcomeTyping = ref(false)
  /** Trigger welcome typing on Home - set true after dashboard animation finishes */
  const startWelcomeTyping = ref(false)

  function setJustLoggedIn(value: boolean) {
    justLoggedIn.value = value
  }

  function setPendingWelcomeTyping(value: boolean) {
    pendingWelcomeTyping.value = value
  }

  function setStartWelcomeTyping(value: boolean) {
    startWelcomeTyping.value = value
  }

  return {
    justLoggedIn,
    setJustLoggedIn,
    pendingWelcomeTyping,
    setPendingWelcomeTyping,
    startWelcomeTyping,
    setStartWelcomeTyping,
  }
})
