'use client';

/**
 * Zustand store for right panel UI state.
 *
 * Manages the right-side panel open/close state and active tab
 * so that the TopNav toggle button and the RightPanel component
 * can share the same state.
 */

import { create } from 'zustand';

export type RightPanelTab = 'notifications' | 'activities' | 'contacts';

export interface RightPanelState {
  isOpen: boolean;
  activeTab: RightPanelTab;
  open: () => void;
  close: () => void;
  toggle: () => void;
  setActiveTab: (tab: RightPanelTab) => void;
}

export const useRightPanelStore = create<RightPanelState>()((set) => ({
  isOpen: false,
  activeTab: 'notifications',
  open: () => set({ isOpen: true }),
  close: () => set({ isOpen: false }),
  toggle: () => set((state) => ({ isOpen: !state.isOpen })),
  setActiveTab: (tab) => set({ activeTab: tab }),
}));
