import { create } from 'zustand';
import { Vehicle } from '../../features/vehicles/types/vehicles.types';

interface AppState {
  // UI state
  sidebarOpen: boolean;
  selectedVehicle: Vehicle | null;

  // Actions
  toggleSidebar: () => void;
  setSidebarOpen: (open: boolean) => void;
  setSelectedVehicle: (vehicle: Vehicle | null) => void;
}

export const useAppStore = create<AppState>((set) => ({
  // Initial state
  sidebarOpen: false,
  selectedVehicle: null,

  // Actions
  toggleSidebar: () => set((state) => ({ sidebarOpen: !state.sidebarOpen })),
  setSidebarOpen: (open: boolean) => set({ sidebarOpen: open }),
  setSelectedVehicle: (vehicle: Vehicle | null) => set({ selectedVehicle: vehicle }),
}));