import * as actions from './actions'
import getters from './getters'
import mutations from './mutations'
import {
  IS_LOGGED_IN,
  LOGGED_IN_USER,
  IS_LOGGED_IN_GUEST,
  LOGGED_GUEST_USER,
  CHANGE_PREFERRED_CONTACT_STATUS,
} from '../../utils/localStorageKeys'

const state = {
  auth: {},
  isLoggedIn: JSON.parse(localStorage.getItem(IS_LOGGED_IN)) || false,
  resetStatus: false,
  resetPasswordStatus: false,
  resetAlert: false,
  showReset: false,
  emailReset: '',
  preferredContact: {},
  resetErrorStatus: false,
  resetErrorMessage: null,
  resetResponseData: null,
  loggedInUser: JSON.parse(localStorage.getItem(LOGGED_IN_USER)) || {},
  loggedInguestUser: JSON.parse(localStorage.getItem(LOGGED_GUEST_USER)) || {},
  isLoggedInGuest: JSON.parse(localStorage.getItem(IS_LOGGED_IN_GUEST)) || false,
  enrolReady: '',
  guest: {},
  rules: {
    tabs: {
      my_account_subscription_tab: false,
    },
  },
  disableRouteCheck: false,
  verifyContactStatus: JSON.parse(localStorage.getItem(CHANGE_PREFERRED_CONTACT_STATUS)) || {
    requires: false,
    skipVerification: false,
  },
  changePasswordStatus: false,
}

export default {
  state,
  actions,
  mutations,
  getters,
}
