import * as actions from './actions'
import getters from './getters'
import mutations from './mutations'
import * as T from '../../utils/localStorageKeys'

const state = {
  member: JSON.parse(localStorage.getItem(T.MEMBER_INFO)) || {
    id: 0,
    user_id: 0,
    country_id: 0,
    name: '',
    translated_name: '',
    nationality_id: 0,
    ic_pass_type_id: 0,
    active_until_cw_id: 0,
    ic_passport_number: '',
    date_of_birth: '',
    cw: '',
    join_date: '',
    expiry_date: '',
    personal_sales_cv: 0,
    personal_sales_cv_percentage: 0,
    effective_rank_id: 0,
    highest_rank_id: 0,
    enrollment_rank_id: 0,
    tin_no_taiwan: '',
    tin_no_philippines: '',
    enroll_from_received: 0,
    ic_pass_verified: 0,
    is_enrollment_terminate: 0,
    defer_bonus_commission: 0,
    defer_reason_id: 0,
    bank_type: 0,
    avatar_image_path: null,
    avatar_image_link: localStorage.getItem(T.MEMBER_AVATAR) || '',
  },
  enrollmentRankList: JSON.parse(localStorage.getItem(T.MEMBER_RANKS_LIST)) || [],
  memberGender: 'Male',
  iboDetails: JSON.parse(localStorage.getItem(T.MEMBER_IBO_DETAILS)) || [],
  memberList: JSON.parse(localStorage.getItem(T.MEMBER_LIST)) || [],
  selectedMemberDetails: [],
  memberInfo: JSON.parse(localStorage.getItem(T.MEMBER_INFORMATION)) || [],
  subscription: JSON.parse(localStorage.getItem(T.MEMBER_SUBSCRIPTION_VALID)) || {
    status: true,
    hasSubscripbedBefore: true,
    expiryDate: new Date(),
    learnMoreLinks: [
      {
        countryId: 1,
        link: 'https://s3-ap-southeast-1.amazonaws.com/nibsprod/member_portal/isp-features-listing.pdf',
      },
    ],
  },

  memberDashboardDetail: {},
  iwbStatus: {},
  totalBvGraphDetail: {},
  goalRankDetail: {},
  tvcRankInfo: {},
  updatedAtTime: new Date().setHours(new Date().getHours() - 2),
  calculating: false,
  builder_status: {},
  founderBonus: null,
}

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