import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/Index'
import UserLogin from '@/components/user/Login'
import UserSetting from '@/components/user/Setting'
import UserRegister from '@/components/user/Register'
import UserResetPassword from '@/components/user/ResetPassword'
import ResetPasswordByUrl from '@/components/user/ResetPasswordByUrl'
import ItemIndex from '@/components/item/Index'
import ItemAdd from '@/components/item/Add'
import ItemPassword from '@/components/item/Password'
import ItemShow from '@/components/item/show/index'
import ItemExport from '@/components/item/export/index'
import ItemSetting from '@/components/item/setting/Index'
import PageIndex from '@/components/page/Index'
import PageEdit from '@/components/page/edit/Index'
import PageDiff from '@/components/page/Diff'
import Catalog from '@/components/catalog/Index'
import Notice from '@/components/notice/Index'


Vue.use(Router);

const TITLE_SUFFIX = '在线文档分享平台 | ZhuLiang\'s Shared';

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      meta: {
        title: TITLE_SUFFIX
      },
      component: Index
    },
    {
      path: '/user/login',
      name: 'UserLogin',
      meta: {
        title: '登录 - ' + TITLE_SUFFIX
      },
      component: UserLogin
    },
    {
      path: '/user/setting',
      name: 'UserSetting',
      meta: {
        title: '个人设置 - ' + TITLE_SUFFIX
      },
      component: UserSetting
    },
    {
      path: '/user/register',
      name: 'UserRegister',
      meta: {
        title: '注册 - ' + TITLE_SUFFIX
      },
      component: UserRegister
    },
    {
      path: '/user/resetPassword',
      name: 'UserResetPassword',
      meta: {
        title: '修改密码 - ' + TITLE_SUFFIX
      },
      component: UserResetPassword
    },
    {
      path: '/user/ResetPasswordByUrl',
      name: 'ResetPasswordByUrl',
      meta: {
        title: TITLE_SUFFIX
      },
      component: ResetPasswordByUrl
    },
    {
      path: '/item/index',
      name: 'ItemIndex',
      meta: {
        title: '文档管理 - ' + TITLE_SUFFIX
      },
      component: ItemIndex
    },
    {
      path: '/item/add',
      name: 'ItemAdd',
      meta: {
        title: '新建项目 - ' + TITLE_SUFFIX
      },
      component: ItemAdd
    },
    {
      path: '/item/password/:item_id',
      name: 'ItemPassword',
      meta: {
        title: '输入密码访问 - ' + TITLE_SUFFIX
      },
      component: ItemPassword
    },
    {
      path: '/:item_id',
      name: 'ItemShow',
      meta: {
        title: TITLE_SUFFIX
      },
      component: ItemShow
    },
    {
      path: '/item/export/:item_id',
      name: 'ItemExport',
      meta: {
        title: '导出 - ' + TITLE_SUFFIX
      },
      component: ItemExport
    },
    {
      path: '/item/setting/:item_id',
      name: 'ItemSetting',
      meta: {
        title: '项目设置 - ' + TITLE_SUFFIX
      },
      component: ItemSetting
    },
    {
      path: '/page/:page_id',
      name: 'PageIndex',
      meta: {
        title: TITLE_SUFFIX
      },
      component: PageIndex
    },
    {
      path: '/page/edit/:item_id/:page_id',
      name: 'PageEdit',
      meta: {
        title: '页面编辑 - ' + TITLE_SUFFIX
      },
      component: PageEdit
    },
    {
      path: '/page/diff/:page_id/:page_history_id',
      name: 'PageDiff',
      meta: {
        title: '历史版本对比 - ' + TITLE_SUFFIX
      },
      component: PageDiff
    },
    {
      path: '/catalog/:item_id',
      name: 'Catalog',
      meta: {
        title: '目录管理 - ' + TITLE_SUFFIX
      },
      component: Catalog
    },
    {
      path: '/notice/index',
      name: 'Notice',
      meta: {
        title: TITLE_SUFFIX
      },
      component: Notice
    },
  ]
})
