import {User} from "@/interfaces/user";
import clsx from "clsx";
import {useRouter} from "next/router";
import BottomBar from "../BottomBar";
import Navbar from "../Navbar";
import Sidebar from "../Sidebar";

interface Props {
	user: User;
	children: React.ReactNode;
	className?: string;
	navDisabled?: boolean;
	focusMode?: boolean;
	bgColor?: string;
	onFocusLayerMouseEnter?: () => void;
}

export default function Layout({user, children, className, bgColor="bg-white", navDisabled = false, focusMode = false, onFocusLayerMouseEnter}: Props) {
	const router = useRouter();

	return (
		<main className={clsx("w-full min-h-full h-screen flex flex-col bg-mti-gray-smoke relative")}>
			<Navbar
				path={router.pathname}
				user={user}
				navDisabled={navDisabled}
				focusMode={focusMode}
				onFocusLayerMouseEnter={onFocusLayerMouseEnter}
			/>
			<div className="h-full w-full flex gap-2">
				<Sidebar
					path={router.pathname}
					navDisabled={navDisabled}
					focusMode={focusMode}
					onFocusLayerMouseEnter={onFocusLayerMouseEnter}
					className="-md:hidden"
					user={user}
				/>
				<div
					className={clsx(
						`w-full min-h-full md:mr-8 ${bgColor} shadow-md rounded-2xl p-4 xl:p-10 pb-8 flex flex-col gap-8 relative overflow-hidden mt-2`,
						bgColor !== "bg-white" ? "justify-center" : "h-fit",
						className,
					)}>
					{children}
				</div>
			</div>
		</main>
	);
}
