import type { MetadataRoute } from "next";
import { getTranslations } from "next-intl/server";
import { site } from "@/config/site";
import { routing } from "@/i18n/routing";

export default async function manifest(): Promise<MetadataRoute.Manifest> {
  const t = await getTranslations({
    locale: routing.defaultLocale,
    namespace: "LocaleLayout",
  });
  return {
    id: "/",
    name: site.name,
    short_name: site.shortName,
    description: t("description"),
    start_url: "/",
    display: "standalone",
    background_color: site.backgroundColor,
    theme_color: site.themeColor,
    lang: routing.defaultLocale,
    icons: [
      { src: "/favicon.ico", sizes: "any", type: "image/x-icon" },
      { src: site.logo.src, sizes: "any", type: "image/svg+xml", purpose: "any" },
      {
        src: "/android-chrome-192x192.png",
        sizes: "192x192",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/android-chrome-512x512.png",
        sizes: "512x512",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/android-chrome-512x512.png",
        sizes: "512x512",
        type: "image/png",
        purpose: "maskable",
      },
    ],
  };
}
