import { create } from 'zustand'

const usePhoneStore = create((set) => ({
  activeCall: null,   // { caller, ext, at, customer, orders } | null
  log: [],            // last 20 calls
  setActiveCall: (call) => set({ activeCall: call }),
  dismissCall: () => set({ activeCall: null }),
  addCallToLog: (entry) => set(s => ({ log: [entry, ...s.log].slice(0, 20) })),
}))

export default usePhoneStore
