import Dashboard from '@pages/Dashboard'
import Home from '@pages/Home'
import House from '@pages/House'
import HouseCreate from '@pages/HouseCreate'
import Layout from '@pages/Layout'
import Login from '@pages/Login'
import Page404 from '@pages/Page404'
import Profile from '@pages/Profile'
import { createBrowserRouter } from 'react-router-dom'

export const PathConstants = {
  LOGIN: '/login',
  PROFILE: '/me',
  DASHBOARD: '/dashboard',
  LOCATION: '/location',
  CREATE_LOCATION: '/location/create',
  EDIT_LOCATION: '/location/edit/:id',
  WAREHOUSE: '/warehouse',
}

const router = createBrowserRouter([
  {
    path: PathConstants.LOGIN,
    element: <Login />,
  },
  {
    path: '/',
    element: <Layout />,
    errorElement: <Page404 />,
    children: [
      {
        path: '',
        element: <Home />,
      },
      {
        path: PathConstants.PROFILE,
        element: <Profile />,
      },
      {
        path: PathConstants.DASHBOARD,
        element: <Dashboard />,
      },
      {
        path: PathConstants.LOCATION,
        element: <House />,
      },
      {
        path: PathConstants.CREATE_LOCATION,
        element: <HouseCreate />,
      },
      {
        path: PathConstants.EDIT_LOCATION,
        element: <HouseCreate />,
      },
    ],
  },
])

export default router
