import {
  AUTOSHIP as URL_PREFIX,
  AUTOSHIP_SUBSCRIPTION_LIST,
  AUTOSHIP_SUBSCRIPTION_DETAIL,
  AUTOSHIP_SUBSCRIPTION_EDIT,
} from '@/config/url-prefix'

export default [
  {
    path: URL_PREFIX,
    component: () => import('@/elements/templates/screens/SidebarFluid'),
    name: 'AutoshipDashBoard',
    redirect: { name: 'AutoshipHomePaginated', params: { page: 1 } },
    meta: {
      dashboardMenu: {
        displayName: 'Autoship.Tab.Autoship', // this is the sidebar title
        priority: 6,
        icon: 'sidebar-autoship',
      },
      policy: {
        'auto-ship': 'view',
      },
    },
    children: [
      {
        path: AUTOSHIP_SUBSCRIPTION_LIST + '/:page',
        component: () => import('./dashboard/AutoshipSubsciptionList'),
        name: 'AutoshipHomePaginated',
        props: {
          default: true,
          page: 1,
        },
        meta: {
          title: 'Autoship.Tab.Autoship',
        },
      },
      // view details
      {
        path: AUTOSHIP_SUBSCRIPTION_DETAIL + '/:orderId',
        component: () => import('./dashboard/AutoshipDetails'),
        name: 'AutoshipDetail',
        props: true,
        meta: {
          title: 'Autoship.AutoshipDetail',
        },
      },
      // Edit subscription
      {
        path: AUTOSHIP_SUBSCRIPTION_EDIT + '/:orderId',
        component: () => import('./dashboard/AutoshipEdit'),
        name: 'AutoshipEdit',
        props: true,
        meta: {
          title: 'Autoship.Tab.EditAutoship',
        },
      },
    ],
  },
]
