/**
 * Router
 */
import { createRouter, createWebHistory } from 'vue-router';
/** Middleware */
import authMiddleware from './middleware/authMiddleware.js';
import guestMiddleware from "@/middleware/guestMiddleware.js";
import adminMiddleware from './middleware/adminMiddleware.js';
import superUserMiddleware from "@/middleware/superUserMiddleware.js";
/** Views */
/**
 * Default page
 */
import DefaultPage from "@/views/DefaultPage.vue";
/** Auth */
import Login from './views/auth/Login.vue';
import Register from './views/auth/Register.vue';
/** Dashboards */
import SuperUserDashboard from './views/dashboards/SuperUserDashboard.vue';
import DepartmentDashboard from './views/dashboards/DepartmentDashboard.vue';
import UserDashboard from './views/dashboards/UserDashboard.vue';

/** Dashboard: SuperUser */
import Departments from "@/views/dashboards/superUserDashboard/Departments.vue";
import Users from "@/views/dashboards/superUserDashboard/Users.vue";
import Products from "@/views/dashboards/superUserDashboard/Products.vue";
import Orders from "@/views/dashboards/superUserDashboard/Orders.vue";
import NumberPlateScanners from "@/views/dashboards/superUserDashboard/NumberPlateScanners.vue";
import Statistics from "@/views/dashboards/superUserDashboard/statistics/Statistics.vue";

/** Dashboard: Department */
import DepartmentPos from "@/views/dashboards/departmentDashboard/modules/Pos/DepartmentPos.vue";
import DepartmentPosOrders from "@/views/dashboards/departmentDashboard/modules/Pos/DepartmentPosOrders.vue";
import DepartmentPosOrder from "@/views/dashboards/departmentDashboard/modules/Pos/DepartmentPosOrder.vue";


/**
 * Dashboard: User
 */
import MyVehicles from "@/views/dashboards/userDashboard/vehicles/MyVehicles.vue";

/** Errors */
import NotFound from './views/errors/NotFound.vue';
import MyOrders from "@/views/dashboards/userDashboard/orders/MyOrders.vue";
import NewVehicle from "@/views/dashboards/userDashboard/vehicles/NewVehicle.vue";
import MyBookings from "@/views/dashboards/userDashboard/bookings/MyBookings.vue";
import DatabaseOverview from "@/views/dashboards/superUserDashboard/system/DatabaseOverview.vue";
import DepartmentBookings from "@/views/dashboards/departmentDashboard/modules/bookings/DepartmentBookings.vue";
import Employee from "@/views/auth/Employee.vue";
import User from "@/views/dashboards/superUserDashboard/user/User.vue";
import UserOrders from "@/views/dashboards/superUserDashboard/user/UserOrders.vue";
import UserPricing from "@/views/dashboards/superUserDashboard/user/UserPricing.vue";
import Department from "@/views/dashboards/superUserDashboard/department/Department.vue";
import DepartmentPricing from "@/views/dashboards/superUserDashboard/department/DepartmentPricing.vue";
import MyOrder from "@/views/dashboards/userDashboard/orders/MyOrder.vue";
import StatisticsOverview from "@/views/dashboards/superUserDashboard/statistics/StatisticsOverview.vue";
import Configuration from "@/views/dashboards/superUserDashboard/configuration/Configuration.vue";
import ConfigurationEconomic from "@/views/dashboards/superUserDashboard/configuration/ConfigurationEconomic.vue";
import ConfigurationReCAPTCHA from "@/views/dashboards/superUserDashboard/configuration/ConfigurationReCAPTCHA.vue";
import ConfigurationEmail from "@/views/dashboards/superUserDashboard/configuration/ConfigurationEmail.vue";
import ConfigurationBackups from "@/views/dashboards/superUserDashboard/configuration/ConfigurationBackups.vue";
import Categories from "@/views/dashboards/superUserDashboard/Categories.vue";
import Customers from "@/views/dashboards/superUserDashboard/Customers.vue";
import DepartmentCategories from "@/views/dashboards/superUserDashboard/department/DepartmentCategories.vue";
import ConfigurationMotorAPI from "@/views/dashboards/superUserDashboard/configuration/ConfigurationMotorAPI.vue";
import ConfigurationStripe from "@/views/dashboards/superUserDashboard/configuration/ConfigurationStripe.vue";
import Roles from "@/views/dashboards/superUserDashboard/roles/Roles.vue";
import SuperUserRolesPermissions from "@/views/dashboards/superUserDashboard/roles/SuperUserRolesPermissions.vue";
import DepartmentStripeTerminalsReaders from "@/views/dashboards/superUserDashboard/department/stripe/DepartmentStripeTerminalsReaders.vue";
import DepartmentStripeSetup from "@/views/dashboards/superUserDashboard/department/stripe/DepartmentStripeSetup.vue";
import CollectedOrderInvoices from "@/views/dashboards/superUserDashboard/CollectedOrderInvoices.vue";
import CollectedOrderInvoice
	from "@/views/dashboards/superUserDashboard/collectedOrderInvoice/collectedOrderInvoice.vue";
import DepartmentDailyReport
	from "@/views/dashboards/departmentDashboard/modules/daily-report/DepartmentDailyReport.vue";
import SuperUserDashboardProduct from "@/views/dashboards/superUserDashboard/products/SuperUserDashboardProduct.vue";
import UserOther from "@/views/dashboards/superUserDashboard/user/UserOther.vue";
import MyBookingsNew from "@/views/dashboards/userDashboard/bookings/MyBookingsNew.vue";
import DepartmentCompleteBooking
	from "@/views/dashboards/departmentDashboard/modules/bookings/DepartmentCompleteBooking.vue";
import GuestHome from "@/views/guest/GuestHome.vue";
import GuestBookExteriorWash from "@/views/guest/book/GuestBookExteriorWash.vue";
import DepartmentProfile from "@/views/dashboards/superUserDashboard/department/DepartmentProfile.vue";
import ConfigurationFXRatesAPI from "@/views/dashboards/superUserDashboard/configuration/ConfigurationFXRatesAPI.vue";
import ConfigurationGatewayAPI from "@/views/dashboards/superUserDashboard/configuration/ConfigurationGatewayAPI.vue";
import UserWashSubscriptions from "@/views/dashboards/superUserDashboard/user/UserWashSubscriptions.vue";
import UserProfile from "@/views/dashboards/userDashboard/profile/UserProfile.vue";
import DepartmentNotifications
	from "@/views/dashboards/departmentDashboard/modules/notifications/DepartmentNotifications.vue";
import Vehicles from "@/views/dashboards/superUserDashboard/Vehicles.vue";
import ConfigurationXLVask from "@/views/dashboards/superUserDashboard/configuration/ConfigurationXLVask.vue";
import UserXLVask from "@/views/dashboards/superUserDashboard/user/UserXLVask.vue";
import DepartmentTimeBookings
	from "@/views/dashboards/departmentDashboard/modules/time-bookings/DepartmentTimeBookings.vue";
import DepartmentTimeBookingsOpeningHours
	from "@/views/dashboards/departmentDashboard/modules/time-bookings/DepartmentTimeBookingsOpeningHours.vue";
import DepartmentTimeBookingsTypes
	from "@/views/dashboards/departmentDashboard/modules/time-bookings/DepartmentTimeBookingsTypes.vue";
import DepartmentModulesSetup
	from "@/views/dashboards/superUserDashboard/department/modules/DepartmentModulesSetup.vue";
import Vehicle from "@/views/dashboards/superUserDashboard/vehicle/Vehicle.vue";
import MyInvoices from "@/views/dashboards/userDashboard/invoices/MyInvoices.vue";
import MicrosoftCallbackToken from "@/views/callback/microsoft/MicrosoftCallbackToken.vue";
import ConfigurationEntra from "@/views/dashboards/superUserDashboard/configuration/ConfigurationEntra.vue";
import DepartmentTimeBookingsNew
	from "@/views/dashboards/departmentDashboard/modules/time-bookings/book/DepartmentTimeBookingsNew.vue";

// Export the router as router
export const router = createRouter({
	history: createWebHistory(),
	routes: [
		{
			name: 'default',
			path: '/',
			component: DefaultPage,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'callbackMicrosoftToken',
			path: '/callback/microsoft/token',
			component: MicrosoftCallbackToken,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'dashboard',
			path: '/user',
			component: UserDashboard,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myprofile',
			path: '/user/profile',
			component: UserProfile,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myvehicles',
			path: '/user/vehicles',
			component: MyVehicles,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myvehiclesnew',
			path: '/user/vehicles/new',
			component: NewVehicle,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'mybookings',
			path: '/user/bookings',
			component: MyBookings,
			meta: { middleware: authMiddleware }
		},

		{
			name: 'mybookingsnew',
			path: '/user/bookings/new',
			component: MyBookingsNew,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myorders',
			path: '/user/orders',
			component: MyOrders,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myinvoices',
			path: '/user/invoices',
			component: MyInvoices,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'myorder',
			path: '/user/orders/:orderId',
			component: MyOrder,
			meta: { middleware: authMiddleware }
		},
		{
			name: 'login',
			path: '/login',
			component: Login,
			meta: { middleware: guestMiddleware }
		},
		{
			name: 'register',
			path: '/register',
			component: Register,
			meta: { middleware: guestMiddleware }
		},
		{
			name: 'adminlogin',
			path: '/admin/login',
			component: Employee,
			meta: { middleware: guestMiddleware }
		},
		{
			name: 'admin',
			path: '/admin',
			component: DepartmentDashboard,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'department',
			path: '/admin/:departmentId',
			component: DepartmentDashboard,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'pos',
			path: '/admin/:departmentId/modules/pos',
			component: DepartmentPos,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'departmentnotifications',
			path: '/admin/:departmentId/modules/notifications',
			component: DepartmentNotifications,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'posorders',
			path: '/admin/:departmentId/modules/pos/orders',
			component: DepartmentPosOrders,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'posorder',
			path: '/admin/:departmentId/modules/pos/orders/:orderId',
			component: DepartmentPosOrder,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'bookings',
			path: '/admin/:departmentId/modules/bookings',
			component: DepartmentBookings,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'bookingsbooking',
			path: '/admin/:departmentId/modules/bookings/:bookingId',
			component: DepartmentCompleteBooking,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'dailyreport',
			path: '/admin/:departmentId/modules/daily-report',
			component: DepartmentDailyReport,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'timebookings',
			path: '/admin/:departmentId/modules/time-bookings',
			component: DepartmentTimeBookings,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'timebookingsopeninghours',
			path: '/admin/:departmentId/modules/time-bookings/opening-hours',
			component: DepartmentTimeBookingsOpeningHours,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'timebookingstypes',
			path: '/admin/:departmentId/modules/time-bookings/types',
			component: DepartmentTimeBookingsTypes,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'timebookingsnew',
			path: '/admin/:departmentId/modules/time-bookings/new',
			component: DepartmentTimeBookingsNew,
			meta: { middleware: adminMiddleware }
		},
		{
			name: 'superuser',
			path: '/superuser',
			component: SuperUserDashboard,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departments',
			path: '/superuser/departments',
			component: Departments,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentsoverview',
			path: '/superuser/departments/:departmentId',
			component: Department,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentspricing',
			path: '/superuser/departments/:departmentId/pricing',
			component: DepartmentPricing,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentsbranding',
			path: '/superuser/departments/:departmentId/branding',
			component: DepartmentProfile,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentscategories',
			path: '/superuser/departments/:departmentId/categories',
			component: DepartmentCategories,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentsterminalsreaders',
			path: '/superuser/departments/:departmentId/stripe/terminals/readers',
			component: DepartmentStripeTerminalsReaders,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentsstripesetup',
			path: '/superuser/departments/:departmentId/stripe/setup',
			component: DepartmentStripeSetup,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'departmentsmodules',
			path: '/superuser/departments/:departmentId/modules',
			component: DepartmentModulesSetup,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'users',
			path: '/superuser/users',
			component: Users,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'user',
			path: '/superuser/users/:userId',
			component: User,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'userorders',
			path: '/superuser/users/:userId/orders',
			component: UserOrders,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'userpricing',
			path: '/superuser/users/:userId/pricing',
			component: UserPricing,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'userother',
			path: '/superuser/users/:userId/other',
			component: UserOther,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'uservehicles',
			path: '/superuser/users/:userId/vehicles',
			component: UserWashSubscriptions,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'userxlvask',
			path: '/superuser/users/:userId/xlvask',
			component: UserXLVask,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'products',
			path: '/superuser/products',
			component: Products,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'productsproduct',
			path: '/superuser/products/:productId',
			component: SuperUserDashboardProduct,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'collectedorderinvoices',
			path: '/superuser/invoices',
			component: CollectedOrderInvoices,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'collectedorderinvoice',
			path: '/superuser/invoices/:collectedOrderInvoiceId',
			component: CollectedOrderInvoice,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'orders',
			path: '/superuser/orders',
			component: Orders,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'scanners',
			path: '/superuser/scanners',
			component: NumberPlateScanners,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'categories',
			path: '/superuser/categories',
			component: Categories,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'systemdatabase',
			path: '/superuser/system/database',
			component: DatabaseOverview,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'statistics',
			path: '/superuser/statistics',
			component: StatisticsOverview,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'statisticsOther',
			path: '/superuser/statistics/other',
			component: Statistics,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configuration',
			path: '/superuser/configuration',
			component: Configuration,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationEconomic',
			path: '/superuser/configuration/economic',
			component: ConfigurationEconomic,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationReCAPTCHA',
			path: '/superuser/configuration/recaptcha',
			component: ConfigurationReCAPTCHA,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationEmail',
			path: '/superuser/configuration/email',
			component: ConfigurationEmail,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationBackup',
			path: '/superuser/configuration/backup',
			component: ConfigurationBackups,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationMotorAPI',
			path: '/superuser/configuration/motorapi',
			component: ConfigurationMotorAPI,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationStripe',
			path: '/superuser/configuration/stripe',
			component: ConfigurationStripe,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationFXRatesAPI',
			path: '/superuser/configuration/fxratesapi',
			component: ConfigurationFXRatesAPI,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationGatewayAPI',
			path: '/superuser/configuration/gatewayapi',
			component: ConfigurationGatewayAPI,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationXLVask',
			path: '/superuser/configuration/xlvask',
			component: ConfigurationXLVask,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'configurationEntra',
			path: '/superuser/configuration/entra',
			component: ConfigurationEntra,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'customers',
			path: '/superuser/customers',
			component: Customers,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'roles',
			path: '/superuser/roles',
			component: Roles,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'vehicles',
			path: '/superuser/vehicles',
			component: Vehicles,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'vehiclesvehicle',
			path: '/superuser/vehicles/:reg',
			component: Vehicle,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'rolesPermissions',
			path: '/superuser/roles/:roleId',
			component: SuperUserRolesPermissions,
			meta: { middleware: superUserMiddleware }
		},
		{
			name: 'guestHome',
			path: '/guest/home',
			component: GuestHome,
		},
		{
			name: 'guestBookWash',
			path: '/guest/book/wash',
			component: GuestBookExteriorWash,
		},
		{
			name: 'notfound',
			path: '/:pathMatch(.*)*',
			component: NotFound
		}
	]
});
