import { ReactNode } from "react";
import { useLocation } from "react-router-dom";
import { Header } from "@/components/header";

interface MainLayoutProps {
  children: ReactNode;
}

export function MainLayout({ children }: MainLayoutProps) {
  const location = useLocation();
  
  // Exclure le layout pour les pages d'authentification
  const authPages = ["/auth/login", "/auth/register"];
  
  if (authPages.includes(location.pathname)) {
    return <>{children}</>;
  }

  return (
    <div className="flex min-h-screen flex-col bg-amber-50">
      <Header />
      <main className="flex-1">
        <div className="mx-auto max-w-7xl">
          {children}
        </div>
      </main>
      <footer className="border-t">
        <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6 md:h-16 md:py-0">
          <div className="flex flex-col items-center justify-between gap-4 md:flex-row">
            <p className="text-center text-sm text-muted-foreground md:text-left">
              &copy; {new Date().getFullYear()} Freedge. Tous droits réservés.
            </p>
            <div className="flex items-center gap-4 text-sm text-muted-foreground">
              <a href="#" className="hover:underline">Mentions légales</a>
              <a href="#" className="hover:underline">Confidentialité</a>
              <a href="#" className="hover:underline">Contact</a>
            </div>
          </div>
        </div>
      </footer>
    </div>
  );
} 