import type { Metadata } from "next";
import "@/styles/globals.css";
import { SiteHeader } from "@/components/SiteHeader";
import { SiteFooter } from "@/components/SiteFooter";
import { ThemeProvider } from "@/components/ThemeProvider";
import { AppProviders } from "@/components/providers/AppProviders";
import { ColorModeProvider } from "@/components/providers/ColorModeProvider";

export const metadata: Metadata = {
  title: {
    default: "TorbatYar — سیستم‌عامل کسب‌وکار",
    template: "%s · TorbatYar",
  },
  description:
    "پلتفرم SaaS تجاری: کشف کسب‌وکار، باندل، trial، داشبورد، اپ‌ها و Billing — metadata-driven",
  openGraph: {
    title: "TorbatYar — سیستم‌عامل کسب‌وکار",
    description: "از کشف نیاز تا داشبورد تولید روی ابر",
    locale: "fa_IR",
    type: "website",
  },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="fa" dir="rtl" suppressHydrationWarning>
      <body className="flex min-h-screen flex-col bg-[var(--canvas)] text-secondary antialiased">
        <ThemeProvider>
          <ColorModeProvider>
            <AppProviders>
              <SiteHeader />
              <main className="flex-1">{children}</main>
              <SiteFooter />
            </AppProviders>
          </ColorModeProvider>
        </ThemeProvider>
      </body>
    </html>
  );
}
