import { create } from 'zustand';
import type { NavView, Conversation } from '@/types';

interface AppState {
  activeView: NavView;
  setActiveView: (view: NavView) => void;
  selectedAccountId: string | null;
  setSelectedAccountId: (id: string | null) => void;
  activeConversationId: string | null;
  setActiveConversationId: (id: string | null) => void;
  conversations: Conversation[];
  setConversations: (list: Conversation[]) => void;
}

export const useAppStore = create<AppState>((set) => ({
  activeView: 'chat',
  setActiveView: (view) => set({ activeView: view }),
  selectedAccountId: null,
  setSelectedAccountId: (id) => set({ selectedAccountId: id }),
  activeConversationId: null,
  setActiveConversationId: (id) => set({ activeConversationId: id }),
  conversations: [],
  setConversations: (list) => set({ conversations: list }),
}));
