import { Info } from "lucide-react";

import { DATA_META } from "@/app/lib/factorio-data";
import type { Locale } from "@/app/lib/types";

export function ReleaseFooter({
  locale,
  showSourceDownload = false,
}: {
  locale: Locale;
  showSourceDownload?: boolean;
}) {
  const labels = {
    en: { contact: "Contact", privacy: "Privacy", legal: "Legal notice", license: "GPL-3.0 license", notices: "Third-party notices", source: "Source code 1.0.0" },
    de: { contact: "Kontakt", privacy: "Datenschutz", legal: "Rechtliche Hinweise", license: "GPL-3.0-Lizenz", notices: "Drittanbieterhinweise", source: "Quellcode 1.0.0" },
    "es-ES": { contact: "Contacto", privacy: "Privacidad", legal: "Aviso legal", license: "Licencia GPL-3.0", notices: "Avisos de terceros", source: "Código fuente 1.0.0" },
    fr: { contact: "Contact", privacy: "Confidentialité", legal: "Mentions légales", license: "Licence GPL-3.0", notices: "Avis de tiers", source: "Code source 1.0.0" },
    it: { contact: "Contatto", privacy: "Privacy", legal: "Note legali", license: "Licenza GPL-3.0", notices: "Avvisi di terze parti", source: "Codice sorgente 1.0.0" },
    ja: { contact: "連絡先", privacy: "プライバシー", legal: "法的情報", license: "GPL-3.0 ライセンス", notices: "第三者通知", source: "ソースコード 1.0.0" },
    ru: { contact: "Контакты", privacy: "Конфиденциальность", legal: "Правовая информация", license: "Лицензия GPL-3.0", notices: "Сторонние компоненты", source: "Исходный код 1.0.0" },
    "zh-CN": { contact: "联系", privacy: "隐私", legal: "法律声明", license: "GPL-3.0 许可证", notices: "第三方声明", source: "源代码 1.0.0" },
    "zh-TW": { contact: "聯絡", privacy: "隱私", legal: "法律聲明", license: "GPL-3.0 授權", notices: "第三方聲明", source: "原始碼 1.0.0" },
  }[locale];

  return (
    <footer className="release-footer" aria-label="Release information">
      <Info className="size-4 shrink-0" />
      <span>Version 1.0.0 · Factorio data {DATA_META.factorioVersion}</span>
      <span aria-hidden="true">·</span>
      <a href="mailto:factoriocalculatorapp.com@gmail.com">
        {labels.contact}: factoriocalculatorapp.com@gmail.com
      </a>
      <a href="/privacy.html">{labels.privacy}</a>
      <a href="/legal.html">{labels.legal}</a>
      <a href="/license.html">{labels.license}</a>
      <a href="/third-party-notices.html">{labels.notices}</a>
      {showSourceDownload ? (
        <a href="/downloads/factorio-calculator-source-1.0.0.zip" download>
          {labels.source}
        </a>
      ) : null}
    </footer>
  );
}
