import {
  ORDER_HISTORY as URL_PREFIX,
  ORDER_HISTORY_EVOUCHER,
  EK_SMART_ORDER_HISTORY,
  ESHOP_ORDER_HISTORY,
  MEMBER_BONUS_ADJUSTMENT,
} from '@/config/url-prefix'

export default [
  {
    path: URL_PREFIX,
    component: () => import('@/elements/templates/screens/SidebarFluid'),
    name: 'OrderHistory',
    redirect: { name: 'OrderHistoryEshopHomePaginated', params: { page: 1 } },
    meta: {
      menuItem: false,
      requiresAuth: false,
      dashboardMenu: {
        displayName: 'OrderHistory.OrderHistory.Title', // this is the sidebar title
        priority: 4,
        icon: 'sidebar-orderhistory',
      },
      policy: {
        'order-history': 'view',
      },
      topMenu: {
        displayName: 'Eshop.Menu.MyOrders', // this is the menu bar for eshop
        position: 'right',
        priority: 2,
      },
    },
    children: [
      {
        path: ESHOP_ORDER_HISTORY + '/:page',
        component: () => import('./components/eShopSalesList'),
        name: 'OrderHistoryEshopHomePaginated',
        props: {
          default: true,
        },
        meta: {
          title: 'OrderHistory.OrderHistory.Title',
          tabDisplayName: 'Common.Eshop',
        },
      },
      {
        path: EK_SMART_ORDER_HISTORY + '/:page',
        component: () => import('./components/ekSmartSalesList'),
        name: 'OrderHistoryEkSmartHomePaginated',
        meta: {
          title: 'OrderHistory.OrderHistory.Title',
          tabDisplayName: 'Common.EKSmart',
        },
        props: true,
      },
      {
        path: ORDER_HISTORY_EVOUCHER + '/:saleId',
        component: () => import('./components/blocks/OrderHistoryEvoucher'),
        name: 'OrderHistoryEvoucher',
        meta: {},
        props: true,
      },
      {
        path: MEMBER_BONUS_ADJUSTMENT + '/:page',
        component: () => import('./components/BonusAdjustmentList'),
        name: 'OrderHistoryBonusAdjustmentPaginated',
        meta: {
          title: 'OrderHistory.OrderHistory.Title',
          tabDisplayName: 'OrderHistory.AdjustmentHistory',
          policy: {
            'bonus-manual-adjustment': 'view',
          },
        },
        props: true,
      },
    ],
  },
]
