import { create } from 'zustand';

type State = {
  inApp: {};
  registration: {
    user: {
      username: string;
      email: string;
      password: string;
    };
  };
};

type Action = {
  registration: {
    updateRegistrationUserData: (registration: State['registration']['user']) => void;
  };
};

const store = create<State & Action>((set) => ({
  inApp: {},
  registration: {
    user: {
      username: '',
      email: '',
      password: ''
    },
    updateRegistrationUserData: (userData) =>
      set((state) => ({ registration: { ...state.registration, user: userData } }))
  }
}));

export default store;
