/* global React, ReactDOM, window */
// Shampooch — main app entry & router
const { useState: useStateApp } = React;

function App() {
  const route = window.useHashRoute();

  // /services/<slug>
  const svcMatch = route.match(/^\/services\/([a-z-]+)$/);
  if (svcMatch) return <window.ServiceDetail slug={svcMatch[1]} />;

  switch (route) {
    case "/":         return <window.HomePage />;
    case "/services": return <window.ServiceHubPage />;
    case "/about":    return <window.AboutPage />;
    case "/reviews":  return <window.ReviewsPage />;
    case "/faq":      return <window.FaqPage />;
    case "/contact":  return <window.ContactPage />;
    case "/book":     return <window.BookPage />;
    default:          return <window.NotFoundPage />;
  }
}

function Root() {
  return (
    <>
      <App />
      <window.ShampoochTweaks />
    </>
  );
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<Root />);
