const Welcome = () => import('~/pages/welcome').then(m => m.default || m)
const Login = () => import('~/pages/auth/login').then(m => m.default || m)
const Register = () => import('~/pages/auth/register').then(m => m.default || m)
const PasswordEmail = () => import('~/pages/auth/password/email').then(m => m.default || m)
const PasswordReset = () => import('~/pages/auth/password/reset').then(m => m.default || m)
const NotFound = () => import('~/pages/errors/404').then(m => m.default || m)

const Home = () => import('~/pages/home').then(m => m.default || m)
const Settings = () => import('~/pages/settings/index').then(m => m.default || m)
const SettingsProfile = () => import('~/pages/settings/profile').then(m => m.default || m)
const SettingsPassword = () => import('~/pages/settings/password').then(m => m.default || m)
const SettingsAdminSupplier = () => import('~/pages/settings/admin-supplier').then(m => m.default || m)
const SettingsAdminCreditSetting = () => import('~/pages/settings/admin-credit-setting').then(m => m.default || m)
const SettingsAdminChinaBank = () => import('~/pages/settings/admin-china-bank').then(m => m.default || m)
const SettingsAdminMalaysiaBank = () => import('~/pages/settings/admin-malaysia-bank').then(m => m.default || m)
const SettingsAdminBankSetting = () => import('~/pages/settings/admin-bank-setting').then(m => m.default || m)
const SettingsAdminMarkingSetting = () => import('~/pages/settings/admin-marking-setting').then(m => m.default || m)
const SettingsAdminTaxSetting = () => import('~/pages/settings/admin-tax-setting').then(m => m.default || m)
const SettingsAdminBillingChargeSetting = () => import('~/pages/settings/admin-billing-charge-setting').then(m => m.default || m)

// Booking
const Upload = () => import('~/pages/booking/uploadUserBankSlip').then(m => m.default || m)
const Confirmation = () => import('~/pages/booking/confirmation').then(m => m.default || m)
const Transfer = () => import('~/pages/booking/transfer').then(m => m.default || m)
const UploadPo = () => import('~/pages/booking/uploadPo').then(m => m.default || m)
const PoComplete = () => import('~/pages/booking/poComplete').then(m => m.default || m)
const X2Completed = () => import('~/pages/booking/x2Completed').then(m => m.default || m)
const Completed = () => import('~/pages/booking/completed').then(m => m.default || m)
const PurchaseOrder = () => import('~/pages/booking/po').then(m => m.default || m)

// Admin booking
const BookingDetail = () => import('~/pages/admin/booking/bookingDetail').then(m => m.default || m)
const Verification = () => import('~/pages/admin/booking/verification').then(m => m.default || m)
const Supplier = () => import('~/pages/admin/booking/supplierBooking').then(m => m.default || m)
const SupplierReport = () => import('~/pages/admin/booking/supplierReport').then(m => m.default || m)
const UploadCNSlip = () => import('~/pages/admin/booking/uploadChinaBankslip').then(m => m.default || m)
const UploadInvoice = () => import('~/pages/admin/booking/uploadInvoice').then(m => m.default || m)
const adminCompleted = () => import('~/pages/admin/booking/completed').then(m => m.default || m)
const adminX2Completed = () => import('~/pages/admin/booking/x2Completed').then(m => m.default || m)


// Admin pages
const AdminHome = () => import('~/pages/admin/home').then(m => m.default || m)
const AdminCompleteOrder = () => import('~/pages/admin/complete-orders').then(m => m.default || m)
const adminUserBookings = () => import('~/pages/admin/userBookings').then(m => m.default || m)
const TransactionHistory = () => import('~/pages/admin/transaction-history').then(m => m.default || m)
const UploadSupplierBankSlip = () => import('~/pages/admin/upload-supplier-bank-slip').then(m => m.default || m)

export default [
  { path: '/', name: 'welcome', component: Login },
  { path: '/login', name: 'login', component: Login },
  { path: '/register', name: 'register', component: Register },
  { path: '/password/reset', name: 'password.request', component: PasswordEmail },
  { path: '/password/reset/:token', name: 'password.reset', component: PasswordReset },

  { path: '/home', name: 'home', component: Home },
  { path: '/settings',
    component: Settings,
    children: [
      { path: '', redirect: { name: 'settings.profile' } },
      { path: 'profile', name: 'settings.profile', component: SettingsProfile },
      { path: 'password', name: 'settings.password', component: SettingsPassword },
      { path: 'admin-supplier', name: 'settings.admin-supplier', component: SettingsAdminSupplier },
      { path: 'admin-credit-setting', name: 'settings.admin-credit-setting', component: SettingsAdminCreditSetting },
      { path: 'admin-china-bank', name: 'settings.admin-china-bank', component: SettingsAdminChinaBank },
      { path: 'admin-malaysia-bank', name: 'settings.admin-malaysia-bank', component: SettingsAdminMalaysiaBank },
      { path: 'admin-bank-setting', name: 'settings.admin-bank-setting', component: SettingsAdminBankSetting },
      { path: 'admin-marking-setting', name: 'settings.admin-marking-setting', component: SettingsAdminMarkingSetting },
      { path: 'admin-tax-setting', name: 'settings.admin-tax-setting', component: SettingsAdminTaxSetting },
      { path: 'admin-billing-charge-setting', name: 'settings.admin-billing-charge-setting', component: SettingsAdminBillingChargeSetting },
    ] },

  // Booking
  { path: '/booking/:id/upload-user-bankslip', name: 'booking.user.upload', component: Upload },
  { path: '/booking/:id/confirmation', name: 'booking.user.confirmation', component: Confirmation },
  { path: '/booking/:id/transfer', name: 'booking.user.transfer', component: Transfer },
  { path: '/booking/:id/upload-po', name: 'booking.user.uploadpo', component: UploadPo },
  { path: '/booking/:id/po-complete', name: 'booking.user.pocomplete', component: PoComplete },
  { path: '/booking/:id/po', name: 'booking.user.po', component: PurchaseOrder },
  { path: '/booking/:id/complete', name: 'booking.user.complete', component: Completed },
  { path: '/booking/:id/x2-complete', name: 'booking.user.x2complete', component: X2Completed },
  
  // Admin booking
  { path: '/booking/:id/booking-detail', name: 'booking.admin.booking.detail', component: BookingDetail },
  { path: '/booking/:id/verification', name: 'booking.admin.verification', component: Verification },
  { path: '/booking/:id/supplier', name: 'booking.admin.supplier', component: Supplier },
  { path: '/booking/:id/supplier-report', name: 'booking.admin.supplier.report', component: SupplierReport },
  { path: '/booking/:id/upload-cn-bankslip', name: 'booking.admin.cnslip', component: UploadCNSlip },
  { path: '/booking/:id/upload-invoice', name: 'booking.admin.invoice', component: UploadInvoice },
  { path: '/booking/:id/admin/complete', name: 'booking.admin.complete', component: adminCompleted },
  { path: '/booking/:id/admin/x2-complete', name: 'booking.admin.x2complete', component: adminX2Completed },

  // Admin pages
  { path: '/admin', name: 'admin.home', component: AdminHome },
  { path: '/admin/complete-orders', name: 'admin.complete', component: AdminCompleteOrder },
  { path: '/admin/:userId/userBookings', name: 'admin.userBookings', component: adminUserBookings },
  { path: '/admin/transaction-history', name: 'admin.transaction-history', component: TransactionHistory },
  { path: '/admin/upload-supplier-bank-slip', name: 'admin.upload-supplier-bank-slip', component: UploadSupplierBankSlip },
  { path: '*', name: 'notfound', component: NotFound }
]
