/**
 * Zustand UI-state store for the lists surface.
 *
 * Owns ONLY UI-shape state — no server data ever enters this store.
 * Server state (lists, items) lives in TanStack Query.
 *
 * Convention: follows calendarStore.ts pattern — no persist middleware,
 * no immer. State is ephemeral; lists UI state does not need persistence.
 *
 * State contract:
 *   activeTab              — which bottom-tab is selected (drives tab active-state)
 *   createListSheetOpen    — whether the "New List" sheet/dialog is open
 */

import { create } from 'zustand';

// ── Types ──────────────────────────────────────────────────────────────────

export interface ListsStore {
  // UI-only state — no server data
  activeTab: 'calendar' | 'lists';
  createListSheetOpen: boolean;

  setActiveTab: (tab: 'calendar' | 'lists') => void;
  setCreateListSheetOpen: (open: boolean) => void;
}

// ── Store ──────────────────────────────────────────────────────────────────

export const useListsStore = create<ListsStore>()((set) => ({
  activeTab: 'calendar',
  createListSheetOpen: false,

  setActiveTab: (tab) => set({ activeTab: tab }),
  setCreateListSheetOpen: (open) => set({ createListSheetOpen: open }),
}));
