import { DefaultFooter, DefaultHeader } from '@@/app/_global/components/blocks'
import * as U from '@/config/url-prefix'

export default [
  {
    path: '/',
    redirect: { name: 'loginMain' },
    component: () => {
      return import('@@/layouts/BaseLayout')
    },
    props: route => ({
      showHeader: route.query.showHeader === 'true',
      showFooter: route.query.showFooter === 'true',
    }),
    meta: {
      template: {
        header: DefaultHeader,
        footer: DefaultFooter,
        containerClass: 'login-screen',
      },
    },
    children: [
      {
        name: 'loginMain',
        path: U.THIRD_PARTY_APP_LOGIN_INTERFACE,
        redirect: { name: 'Login' },
        component: {
          render(c) {
            return c('router-view')
          },
        },
        children: [
          {
            name: 'Login',
            path: U.THIRD_PARTY_APP_LOGIN,
            component: () => import('@@/app/login/components/Login'),
            meta: {
              pageTittle: '3rdparty.Login.LoginForm.LoginTitle',
            },
          },
          {
            name: 'ForgotPassword',
            path: U.THIRD_PARTY_APP_FORGOT_PASSWORD,
            component: () => import('@@/app/login/components/ForgotPassword'),
            meta: {
              pageTittle: '3rdparty.Login.LoginForm.forgotPasswordTitle',
            },
          },
          {
            name: 'OTPResetPassword',
            path: U.THIRD_PARTY_APP_OTP_RESET + '/:userId?',
            component: () => import('@@/app/login/components/OtpResetPassword'),
            props: true,
            meta: {
              pageTittle: 'Login.LoginForm.ResetPassword.Title',
            },
          },
          {
            name: 'PreferredContact',
            path: U.THIRD_PARTY_APP_PREFERRED_CONTACT,
            component: () => import('@@/app/login/components/PreferredContact'),
            meta: {
              pageTittle: 'Common.PreferredContact',
            },
          },
          {
            name: 'ChangePassword',
            path: U.THIRD_PARTY_APP_CHANGE_PASSWORD,
            component: () => import('@@/app/login/components/ChangePassword'),
            meta: {
              pageTittle: 'Login.LoginForm.ChangePassword',
            },
          },
          {
            name: 'Logout',
            path: U.THIRD_PARTY_APP_LOGOUT,
            component: () => import('@@/app/login/components/Logout'),
          },
        ],
      },
    ],
  },
]
