import Auth from '@/student/layout/auth'
import HomeAuth from '@/student/home-layout-orchestra/auth'
import { router, rootRouter } from './routes-common'

type metaType = {
  isRegister: boolean
}

const noLoginRouter = [
  {
    path: '/share-music-sheet',
    name: 'share-music-sheet',
    component: () => import('@/teacher/share-page/share-music-sheet/index'),
    meta: {
      title: '分享乐曲'
    }
  },
  {
    path: '/leaderboard',
    component: () => import('@/student/leaderboard/index'),
    meta: {
      title: '曲目挑战排行榜'
      // isExternal: true // 是否外部浏览器可以打开
    }
  }
]

export default [
  {
    path: '/',
    component: Auth,
    children: [
      ...router,
      {
        path: '/login',
        name: 'login',
        component: () => import('@/student/layout/login'),
        meta: {
          isRegister: false
        } as metaType
      },

      {
        path: '/practiceClass',
        name: 'practiceClass',
        component: () => import('@/student/practice-class/index'),
        meta: {
          title: '陪练课'
        }
      },
      {
        path: '/videoDetail',
        name: 'videoDetail',
        component: () => import('@/student/video-class/video-detail'),
        meta: {
          title: '视频课'
        }
      },
      {
        path: '/videoClassDetail',
        name: 'videoClassDetail',
        component: () => import('@/student/video-class/video-class-detail'),
        meta: {
          title: '视频课详情'
        }
      },
      {
        path: '/liveDetail',
        name: 'liveDetail',
        component: () => import('@/student/live-class/live-detail'),
        meta: {
          title: '直播课详情'
        }
      },
      {
        path: '/memberActive',
        name: 'memberActive',
        component: () => import('@/student/member-center/member-active'),
        meta: {
          title: '小酷Ai会员大放价'
        }
      },
      {
        path: '/memberActiveO',
        name: 'memberActiveO',
        component: () => import('@/student/member-center/member-active-o'),
        meta: {
          title: '元旦狂想曲小酷送好礼'
        }
      },
      {
        path: '/memberRecord',
        name: 'memberRecord',
        component: () => import('@/student/member-center/member-record'),
        meta: {
          title: '练习统计'
        }
      },
      {
        path: '/tradeRecord',
        name: 'tradeRecord',
        component: () => import('@/student/trade/index'),
        meta: {
          title: '交易记录'
        }
      },
      {
        path: '/teacherHome',
        name: 'teacherHome',
        component: () => import('@/student/teacher-dependent/teacher-home'),
        meta: {
          title: '老师主页'
        }
      },
      {
        path: '/teacherElegant',
        name: 'teacherElegant',
        component: () => import('@/student/teacher-dependent/teacher-elegant'),
        meta: {
          title: '老师风采'
        }
      },
      {
        path: '/music-upload',
        component: () => import('@/teacher/music/upload'),
        meta: {
          title: '上传曲谱'
        }
      },
      {
        path: '/teacherFollow',
        component: () => import('@/student/teacher-dependent/teacher-follow'),
        meta: {
          title: '我的关注'
        }
      },
      {
        path: '/track-review-activity',
        component: () =>
          import('@/student/share-active/track-review-activity/index'),
        meta: {
          title: '曲目评测活动',
          isExternal: true // 是否外部浏览器可以打开
        }
      },

      {
        path: '/track-song',
        component: () =>
          import('@/student/share-active/track-review-activity/track-song'),
        meta: {
          title: '评测曲目'
        }
      }
    ]
  },
  {
    path: '/home-layout',
    component: HomeAuth,
    children: [
      {
        path: '/home-auth',
        name: 'home-auth',
        component: () => import('@/student/home-layout-orchestra/auth-login'),
        meta: {
          title: '登录酷乐秀'
        }
      },
      {
        path: '/home-layout-center',
        name: 'home-layout-center',
        component: () =>
          import('@/student/home-layout-orchestra/home-layout-center'),
        meta: {
          title: '登录酷乐秀'
        }
      },
      {
        path: '/home-login',
        name: 'home-login',
        component: () => import('@/student/home-layout-orchestra/login'),
        meta: {
          title: '登录酷乐秀'
        }
      },
      {
        path: '/home',
        name: 'home',
        component: () => import('@/student/home/index')
      }
    ]
  },
  ...noLoginRouter,
  ...rootRouter,
  {
    path: '/inviteTeacher',
    name: 'inviteTeacher',
    component: () => import('@/student/invite-teacher/index'),
    meta: {
      title: '邀请学员'
    }
  },
  {
    path: '/inviteSuccess',
    name: 'inviteSuccess',
    component: () => import('@/student/invite-teacher/invite-success'),
    meta: {
      title: '注册成功'
    }
  },
  {
    path: '/transfer',
    component: () => import('@/student/down-load/transfer'),
    meta: {
      title: '酷乐秀学院'
    }
  },
  {
    path: '/download',
    component: () => import('@/student/down-load/download')
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/404'),
    meta: {
      title: '404 Not Fund',
      platform: 'STUDENT'
    }
  }
]
