import React from "react";
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import { InitialLoading } from "@/components/initialLoading/initialLoading";
import { Providers } from "@/components/provider";

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: {
    default: "Ignum Technologies - Fire Safety Systems Installation & Sales",
    template: "%s | Ignum Technologies",
  },
  description:
    "Ignum Technologies specializes in professional fire safety systems installation and sales. Protect your property with cutting-edge fire detection, suppression, and alarm systems from certified experts.",
  keywords: [
    "fire safety systems",
    "fire alarm installation",
    "fire suppression systems",
    "fire detection",
    "Ignum Technologies",
    "fire safety equipment",
    "fire protection services",
    "commercial fire systems",
    "residential fire safety",
  ],
  authors: [{ name: "Ignum Technologies" }],
  creator: "Ignum Technologies",
  publisher: "Ignum Technologies",
  formatDetection: {
    email: false,
    address: false,
    telephone: false,
  },
  metadataBase: new URL("https://ignum-tech.com"), // O'zingizning domen manzilingizni kiriting
  alternates: {
    canonical: "/",
  },
  openGraph: {
    type: "website",
    locale: "uz_UZ",
    url: "https://ignum-tech.com",
    siteName: "Ignum Technologies",
    title: "Ignum Technologies - Professional Fire Safety Systems",
    description:
      "Leading provider of fire safety systems installation and sales. Comprehensive fire protection solutions including detection, suppression, and alarm systems for commercial and residential properties.",
    images: [
      {
        url: "/og-image.jpg", // 1200x630 o'lchamda rasm qo'shing
        width: 1200,
        height: 630,
        alt: "Ignum Technologies - Fire Safety Systems",
      },
      {
        url: "/og-image-square.jpg", // 1200x1200 o'lchamda rasm qo'shing
        width: 1200,
        height: 1200,
        alt: "Ignum Technologies Logo",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "Ignum Technologies - Fire Safety Systems Installation & Sales",
    description:
      "Professional fire safety systems installation and sales. Protect your property with certified fire detection, suppression, and alarm solutions.",
    images: ["/twitter-image.jpg"], // 1200x600 o'lchamda rasm qo'shing
    creator: "@ignumtech", // Twitter username-ingizni kiriting
  },
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      "max-video-preview": -1,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
  icons: {
    icon: [
      {
        url: "/icon-light-32x32.png",
        media: "(prefers-color-scheme: light)",
      },
      {
        url: "/icon-dark-32x32.png",
        media: "(prefers-color-scheme: dark)",
      },
      {
        url: "/icon.svg",
        type: "image/svg+xml",
      },
    ],
    apple: "/apple-icon.png",
  },
  verification: {
    google: "your-google-verification-code", // Google Search Console verification kodi
    // yandex: "your-yandex-verification-code", // Agar kerak bo'lsa
  },
};

export default async function RootLayout({
  children,
  params,
}: Readonly<{
  children: React.ReactNode;
  params: any;
}>) {
  const { locale } = await params;
  const messages: any = await getMessages();

  return (
    <html lang={locale} suppressHydrationWarning>
      <head>
        {/* Qo'shimcha SEO elementlar */}
        <link rel="manifest" href="/manifest.json" />
        <meta name="theme-color" content="#FF4500" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="default" />
        <meta name="apple-mobile-web-app-title" content="Ignum Tech" />
      </head>
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        <InitialLoading />
        <NextIntlClientProvider messages={messages} locale={locale}>
          <Providers>{children}</Providers>
        </NextIntlClientProvider>
      </body>
    </html>
  );
}