import { create } from 'zustand';

interface UserState {
  firstName: string;
  lastName: string;
  phoneNumber: string;
  setUser: (user: Partial<UserState>) => void;
  clearUser: () => void;
}

export const useUserStore = create<UserState>(set => ({
  firstName: '',
  lastName: '',
  phoneNumber: '',

  setUser: user =>
    set(state => ({
      ...state,
      ...user,
    })),

  clearUser: () =>
    set({
      firstName: '',
      lastName: '',
      phoneNumber: '',
    }),
}));
