import favicon from "@/assets/images/favicon.png";
import { Rtl } from "@/core/utils/cacheRtl";
import { AuthProvider } from "@/lib/contexts/auth";
import { TableSettingProvider } from "@/lib/contexts/tableSetting";
import { AppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";

export const metadata = {
  title: {
    template: "%s | سامانه CRM",
    default: "سامانه CRM",
  },
};

export default function RootLayout({ children }) {
  return (
    <html lang="fa" dir={"rtl"}>
      <head>
        <link rel="icon" href={favicon.src} type="image/png" sizes="any" />
      </head>
      <body style={{ height: "100vh", width: "100vw" }}>
        <AppRouterCacheProvider
          CacheProvider={Rtl}
          options={{ enableCssLayer: true }}
        >
          <AuthProvider>
            <TableSettingProvider>{children}</TableSettingProvider>
          </AuthProvider>
        </AppRouterCacheProvider>
      </body>
    </html>
  );
}
