import { create } from 'zustand'
import { persist } from 'zustand/middleware'

/**
 * 대시보드 보기 모드 설정 저장 Store
 */

export type ViewMode = 'basic' | 'yield' | 'quality'

interface ViewPreferenceStore {
  viewMode: ViewMode
  setViewMode: (mode: ViewMode) => void
}

export const useViewPreferenceStore = create<ViewPreferenceStore>()(
  persist(
    (set) => ({
      viewMode: 'basic',
      setViewMode: (mode) => set({ viewMode: mode }),
    }),
    {
      name: 'view-preference-storage',
    }
  )
)
