import Link from "next/link";
import type { Locale } from "@/lib/i18n";
import type { CommonContent } from "@/content/types";
import { getModeValue, isComingSoonMode } from "@/lib/site";

type SiteFooterProps = {
  locale: Locale;
  common: CommonContent;
};

export default function SiteFooter({ locale, common }: SiteFooterProps) {
  const year = new Date().getFullYear();
  const commonVariant = getModeValue(common.variants);
  const isComingSoon = isComingSoonMode();

  return (
    <footer className="site-footer">
      <div className="container footer-content">
        <div className="footer-copy">
          <p>{common.footerRights.replace("{year}", String(year))}</p>
          <p>{commonVariant.footerBuiltWith}</p>
        </div>
        {!isComingSoon ? (
          <div className="flex flex-wrap items-center gap-4">
            <nav aria-label={common.legal.label} className="flex flex-wrap gap-3 text-sm">
              <Link href={`/${locale}/legal/privacy`} className="hover:text-foreground hover:underline">{common.legal.privacy}</Link>
              <Link href={`/${locale}/legal/terms`} className="hover:text-foreground hover:underline">{common.legal.terms}</Link>
              <Link href={`/${locale}/legal/impressum`} className="hover:text-foreground hover:underline">{common.legal.impressum}</Link>
            </nav>
            <p className="locale-badge">{locale.toUpperCase()}</p>
          </div>
        ) : null}
      </div>
    </footer>
  );
}
