import Auth from '@/views/layout/auth'
import MusicAuth from '@/student/music-group/layout/auth'
import { router, rootRouter } from './routes-common'

type metaType = {
  isRegister: boolean
}

const noLoginRouter = [
  {
    path: '/payment-result',
    name: 'payment-result',
    component: () => import('@/student/payment-result/index'),
    meta: {
      title: '支付详情'
    }
  },
  {
    path: '/download',
    name: 'download',
    component: () => import('@/student/download/index'),
    meta: {
      title: '下载管乐团学生端'
    }
  },
  {
    path: '/transfer',
    component: () => import('@/student/download/transfer'),
    meta: {
      title: '管乐团'
    }
  },
]

export default [
  {
    path: '/',
    component: Auth,
    children: [
      ...router,
      {
        path: '/login',
        name: 'login',
        component: () => import('@/views/layout/login'),
        meta: {
          isRegister: false
        } as metaType
      },
      {
        path: '/home',
        name: 'home',
        component: () => import('@/student/home/index')
      },
      {
        path: '/coupons',
        name: 'coupons',
        component: () => import('@/student/coupons/index'),
        meta: {
          title: '优惠券'
        }
      },
      {
        path: '/memberCenter',
        name: 'memberCenter',
        component: () => import('@/student/member-center/index'),
        meta: {
          title: '会员中心'
        }
      },
      {
        path: '/tradeRecord',
        name: 'tradeRecord',
        component: () => import('@/student/trade-record/index'),
        meta: {
          title: '交易记录'
        }
      },
      {
        path: '/my-orchestra',
        name: 'my-orchestra',
        component: () => import('@/student/my-orchestra/index'),
        meta: {
          title: '我的乐团'
        }
      },
      {
        path: '/photo-detail',
        name: 'photo-detail',
        component: () => import('@/student/my-orchestra/photo-detail'),
        meta: {
          title: '相片'
        }
      },
      {
        path: '/apply-withdrawal',
        name: 'apply-withdrawal',
        component: () => import('@/student/my-orchestra/apply-withdrawal'),
        meta: {
          title: '申请退团'
        }
      },
      {
        path: '/attendance-rule',
        name: 'attendance-rule',
        component: () => import('@/views/attendance-rule/index'),
        meta: {
          title: '考勤规则'
        }
      },
      {
        path: '/ranking-list',
        name: 'ranking-list',
        component: () => import('@/student/ranking-list/index'),
        meta: {
          title: '排行榜'
        }
      },
      {
        path: '/exercise-record',
        name: 'exercise-record',
        component: () => import('@/views/exercise-record'),
        meta: {
          title: '练习记录'
        }
      },
      {
        path: '/exercis-detail',
        name: 'exercis-detail',
        component: () => import('@/views/exercise-record/exercis-detail'),
        meta: {
          title: '练习统计'
        }
      }
    ]
  },
  {
    // 只针对乐团报名
    path: '/msuicGroup',
    component: MusicAuth,
    children: [
      {
        path: '/loginMusic',
        name: 'loginMusic',
        component: () => import('@/student/music-group/layout/login'),
        meta: {
          isRegister: false
        } as metaType
      },
      {
        path: '/preApply',
        name: 'preApply',
        component: () => import('@/student/music-group/pre-apply/index'),
        meta: {
          title: '乐团报名'
        }
      },
      {
        path: '/orderDetail',
        name: 'orderDetail',
        component: () => import('@/student/music-group/pre-apply/order-detail'),
        meta: {
          title: '订单详情'
        }
      },
      {
        path: '/shopAddress',
        name: 'shopAddress',
        component: () => import('@/student/music-group/shop-address/index'),
        meta: {
          title: '收货地址'
        }
      },
      {
        path: '/addressOperation',
        name: 'addressOperation',
        component: () => import('@/student/music-group/shop-address/address-operation'),
        meta: {
          title: '收货地址'
        }
      }

      // 非乐团报名的路由不要放在这里，放到上面去
    ]
  },

  ...noLoginRouter,
  ...rootRouter
]
