import { create } from 'zustand'
import type { ReminderType, ReminderStatus, ReminderPriority } from '../domain/reminder'

interface ReminderStore {
  selectedId: string | null
  setSelectedId: (id: string | null) => void
  drawerOpen: boolean
  setDrawerOpen: (open: boolean) => void
  filterType: ReminderType | 'ALL'
  setFilterType: (t: ReminderType | 'ALL') => void
  filterStatus: ReminderStatus | 'ALL'
  setFilterStatus: (s: ReminderStatus | 'ALL') => void
  filterPriority: ReminderPriority | 'ALL'
  setFilterPriority: (p: ReminderPriority | 'ALL') => void
  searchQuery: string
  setSearchQuery: (q: string) => void
  viewMode: 'list' | 'card'
  setViewMode: (m: 'list' | 'card') => void
}

export const useReminderStore = create<ReminderStore>((set) => ({
  selectedId: null,
  setSelectedId: (id) => set({ selectedId: id }),
  drawerOpen: false,
  setDrawerOpen: (open) => set({ drawerOpen: open }),
  filterType: 'ALL',
  setFilterType: (t) => set({ filterType: t }),
  filterStatus: 'ALL',
  setFilterStatus: (s) => set({ filterStatus: s }),
  filterPriority: 'ALL',
  setFilterPriority: (p) => set({ filterPriority: p }),
  searchQuery: '',
  setSearchQuery: (q) => set({ searchQuery: q }),
  viewMode: 'list',
  setViewMode: (m) => set({ viewMode: m }),
}))
