import { t } from "../config/site.js";

const ROUTE_SEO = {
  "/": { navId: "home", titleKey: "seoTitleHome", descKey: "seoDescHome" },
  "/market": { navId: "market", titleKey: "seoTitleMarket", descKey: "seoDescMarket" },
  "/bonuslar": { navId: "bonuses", titleKey: "seoTitleBonuses", descKey: "seoDescBonuses" },
  "/promosyon-kodlari": { navId: "promo-codes", titleKey: "seoTitlePromoCodes", descKey: "seoDescPromoCodes" },
  "/biletler": { navId: "tickets", titleKey: "seoTitleTickets", descKey: "seoDescTickets" },
  "/etkinlikler": { navId: "events", titleKey: "seoTitleEvents", descKey: "seoDescEvents" },
  "/haberler": { navId: "news", titleKey: "seoTitleNews", descKey: "seoDescNews" },
  "/ana-sponsorlar": { navId: "ana-sponsors", titleKey: "seoTitleSponsors", descKey: "seoDescSponsors" },
  "/iletisim": { navId: "contact", titleKey: "seoTitleContact", descKey: "seoDescContact" },
  "/gizlilik-guvenlik": { navId: "legal", titleKey: "seoTitlePrivacy", descKey: "seoDescPrivacy" },
  "/kurallar-sartlar": { navId: "legal", titleKey: "seoTitleTerms", descKey: "seoDescTerms" },
  "/cerez-politikasi": { navId: "legal", titleKey: "seoTitleCookies", descKey: "seoDescCookies" },
  "/liderlik": { navId: "leaderboard", titleKey: "seoTitleLeaderboard", descKey: "seoDescLeaderboard" },
  "/gamdom-cevrim-turnuvasi": {
    navId: "gamdom-turnuva",
    titleKey: "seoTitleGamdomTurnuva",
    descKey: "seoDescGamdomTurnuva",
  },
  "/sans-carki": { navId: "wheel", titleKey: "seoTitleWheel", descKey: "seoDescWheel" },
  "/profil": { navId: "profile", titleKey: "seoTitleProfile", descKey: "seoDescProfile" },
  "/sikayet-oneri": { navId: "complaints", titleKey: "seoTitleComplaints", descKey: "seoDescComplaints" },
  "/affiliate-gecis": { navId: "affiliate", titleKey: "seoTitleAffiliate", descKey: "seoDescAffiliate" },
  "/telegram-davet": { navId: "telegram-invite", titleKey: "seoTitleTelegramInvite", descKey: "seoDescTelegramInvite" },
  "/oyunlar": { navId: "games", titleKey: "seoTitleGames", descKey: "seoDescGames" },
  "/oyun-secici": { navId: "game-selector", titleKey: "seoTitleGameSelector", descKey: "seoDescGameSelector" },
  "/oyunlar/blackjack": { navId: "games", titleKey: "seoTitleBlackjack", descKey: "seoDescBlackjack" },
  "/oyunlar/slot": { navId: "games", titleKey: "seoTitleSlot", descKey: "seoDescSlot" },
  "/oyunlar/rulet": { navId: "games", titleKey: "seoTitleRoulette", descKey: "seoDescRoulette" },
  "/ozel-oranlar": { navId: "special-odds", titleKey: "seoTitleSpecialOdds", descKey: "seoDescSpecialOdds" },
};

export function getRouteMeta(path) {
  const def = ROUTE_SEO[path] || ROUTE_SEO["/"];
  return {
    navId: def.navId,
    title: t(def.titleKey),
    description: t(def.descKey),
  };
}

export function syncRouteSeo(path) {
  const meta = getRouteMeta(path);
  document.title = meta.title;
  return meta;
}
