import { MY_ACCOUNT as URL_PREFIX } from '@/config/url-prefix'
import AppSetting from '@/config/app-settings'

export default [
  {
    path: URL_PREFIX,
    component: () => import('@/elements/templates/screens/SidebarFluid'),
    name: 'MyAccount',
    redirect: { name: 'MyAccountBusinessInfo' },
    meta: {
      menuItem: false,
      requiresAuth: false,
      dashboardMenu: {
        displayName: 'MyAccount.Title', // this is the sidebar title
        priority: 10,
        icon: 'sidebar-myaccount',
      },
    },
    children: [
      {
        path: URL_PREFIX + '/address-info',
        component: () => import('./components/AddressInfo'),
        name: 'MyAccountAddressInfo',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.Address.Title',
        },
      },
      {
        path: URL_PREFIX + '/subscription',
        component: () => import('./components/Subscription'),
        name: 'Subscription',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.Subscription.Title',
        },
      },
      {
        path: URL_PREFIX + '/business-info',
        component: () => import('./components/BusinessInfo'),
        name: 'MyAccountBusinessInfo',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.BusinessInfo.Title',
          policy: {
            'my-account': 'view',
          },
        },
      },
      {
        path: URL_PREFIX + '/personal-info',
        component: () => import('./components/PersonalInfo'),
        name: 'MyAccountPersonalInfo',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.PersonalInfo.Title',
        },
      },
      {
        path: URL_PREFIX + '/bonus-info',
        component: () => import('./components/BonusInfo'),
        name: 'MyAccountBonusInfo',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.BonusInfo.Title',
        },
      },
      {
        path: URL_PREFIX + '/placement-preference',
        component: () => import('./components/PlacementPreference'),
        name: 'MyAccountPlacementPreference',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.PlacementPreference.Title',
        },
        beforeEnter: (to, from, next) => {
          next(AppSetting.placementPreference.enable)
        },
      },
      {
        path: URL_PREFIX + '/change-password',
        component: () => import('./components/ChangePassword'),
        name: 'MyAccountChangePassword',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.ChangePassword.Title',
        },
      },
      {
        path: URL_PREFIX + '/ewallet-settings',
        component: () => import('./components/EWalletSettings'),
        name: 'MyAccountEwalletSettings',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.EwalletSettings.Title',
        },
      },
      {
        path: URL_PREFIX + '/amp-preference',
        component: () => import('./components/AmpPreference'),
        name: 'MyAccountAmpPreferencesSettings',
        meta: {
          title: 'MyAccount.Title',
          tabDisplayName: 'MyAccount.AmpPreference.Title',
        },
        beforeEnter: (to, from, next) => {
          next(AppSetting.myAccount.ampPreference)
        },
      },
    ],
  },
]
