import validatorRouter from './validator';
import { isPopupEnv } from '@/browser/api';

const isUsePpopup = isPopupEnv;

const productRouter = [
  {
    path: '/tiktok/product/clone/:id',
    component: () => import('@/vue/views/Tiktok/Product/Clone.vue'),
    name: 'TiktokProductClone',
    beforeEnter: validatorRouter.paramIdNumber,
    meta: {
      layout: isUsePpopup ? 'popup' : 'default',
      requireAuth: true,
    },
  },
  {
    path: '/tiktok/spy/market',
    component: () => import('@/vue/views/Tiktok/Spy/Market.vue'),
    name: 'TiktokSpyMarket',
    meta: {
      layout: 'default',
      pageTitleKey: 'TIKTOK_MARKET',
      pageIcon: 'fa fa-home',
    },
  },
  {
    path: '/tiktok/spy/category/:id',
    component: () => import('@/vue/views/Tiktok/Spy/Category.vue'),
    name: 'TiktokSpyCategory',
    beforeEnter: validatorRouter.paramIdNumber,
    meta: {
      layout: 'default',
      pageTitleKey: 'TIKTOK_SPY',
      pageIcon: 'fa fa-home',
      requireAuth: true,
    },
  },
];

export default [...productRouter];
