import type { Route } from '@/global'

const Layout = () => import('@/layouts/index.vue')

const routes: Route.recordRaw[] = [
  {
    path: '/customer',
    component: Layout,
    redirect: '/customer/bench',
    name: 'CustomerBench',
    meta: {
      title: '工作台',
      icon: 'ep:key',
      auth: '/customer/bench',
    },
    children: [
      {
        path: 'bench',
        name: 'CustomerBenchPage',
        component: () => import('@/views/customer/bench/bench.vue'),
        meta: {
          title: '工作台',
          auth: '/customer/bench',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/customer',
        },
      },
    ],
  },
  {
    path: '/sample',
    component: Layout,
    redirect: '/sample/list',
    name: 'Sample',
    meta: {
      title: '样品库',
      icon: 'ep:key',
      auth: '/sample',
    },
    children: [
      {
        path: 'list',
        name: 'SampleList',
        component: () => import('@/views/customer/sample/list/list.vue'),
        meta: {
          title: '样品列表',
          icon: 'ep:key',
          auth: '/sample/list',
        },
      },
      {
        path: ':type/:id?',
        name: 'SampleDetail',
        component: () => import('@/views/customer/sample/list/edit.vue'),
        meta: {
          title: '样品详情',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/sample/list',
        },
      },
      {
        path: 'overtime',
        name: 'OvertimeSample',
        component: () => import('@/views/customer/sample/overTime/list.vue'),
        meta: {
          title: '到期样品',
          icon: 'ep:key',
          auth: '/sample/overtime',
        },
      },
    ],
  },
  {
    path: '/customerManage',
    component: Layout,
    redirect: '/customerManage/list',
    name: 'Customer',
    meta: {
      title: '客户管理',
      icon: 'ep:key',
      auth: '/customer/manage',
    },
    children: [
      {
        path: 'list',
        name: 'CustomerList',
        component: () => import('@/views/customer/customerInfo/customerList.vue'),
        meta: {
          title: '客户列表',
          icon: 'ep:key',
          auth: '/customer/list',
        },
      },
      {
        path: ':type/:id?',
        name: 'CustomerDetail',
        component: () => import('@/views/customer/customerInfo/customerEdit.vue'),
        meta: {
          title: '客户详情',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/customerManage/list',
        },
      },
      {
        path: 'advice',
        name: 'CustomerAdvice',
        component: () => import('@/views/customer/advice/adviceList.vue'),
        meta: {
          title: '客户关系',
          icon: 'ep:key',
          auth: '/customer/advice',
        },
      },
      {
        path: 'advice/:type/:id?',
        name: 'CustomerAdviceDetail',
        component: () => import('@/views/customer/advice/adviceEdit.vue'),
        meta: {
          title: '客户关系详情',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/source/approve',
        },
      },
    ],
  },
]

export default routes
