import Vue from 'vue'
import VueRouter from 'vue-router'
import HomePageWrapper from '@/views/Home/HomePageWrapper.vue'
import IndexPage from '@/views/Home/IndexPage.vue'
import AboutPage from '@/views/Home/AboutPage.vue'
import ColorfulPage from '@/views/Home/ColorfulPage.vue'
import CulturePage from '@/views/Home/CulturePage.vue'
import JoinUsPage from '@/views/Home/JoinUsPage.vue'
import SupplierApplyPage from '@/views/Home/SupplierApplyPage.vue'
import SupplierReportPage from '@/views/Home/SupplierReportPage.vue'
import ContactPage from '@/views/Home/ContactPage.vue'
import ArticlePage from '@/views/Home/ArticlePage.vue'

Vue.use(VueRouter)

/**
 * @type {import('vue-router').RouteConfig[]}
 */
const routes = [
  {
    path: '/',
    component: HomePageWrapper,
    children: [
      {
        path: '/',
        name: 'IndexPage',
        component: IndexPage,
        meta: { title: '首页' },
      },
      {
        path: '/about',
        name: 'AboutPage',
        component: AboutPage,
        meta: { title: '关于晶闪' },
      },
      {
        path: '/colorful',
        name: 'ColorfulPage',
        component: ColorfulPage,
        meta: { title: '多彩晶闪' },
      },
      {
        path: '/culture',
        name: 'CulturePage',
        component: CulturePage,
        meta: { title: '企业文化' },
      },
      {
        path: '/join-us',
        name: 'JoinUsPage',
        component: JoinUsPage,
        meta: { title: '加入我们' },
      },
      {
        path: '/supplier-apply',
        name: 'SupplierApplyPage',
        component: SupplierApplyPage,
        meta: { title: '申请加入' },
      },
      {
        path: '/supplier-report',
        name: 'SupplierReportPage',
        component: SupplierReportPage,
        meta: { title: '供应商举报信' },
      },
      {
        path: '/contact',
        name: 'ContactPage',
        component: ContactPage,
        meta: { title: '联系我们' },
      },
      {
        path: '/article/:id',
        name: 'ArticlePage',
        component: ArticlePage,
        props: true,
        meta: { title: '文章' },
      },
    ],
  },
]

const router = new VueRouter({
  routes,
  mode: 'history',
})

export default router
