import pkg from "../../../package.json";

const appVersion =
  process.env.NEXT_PUBLIC_APP_VERSION ??
  pkg.version;
const gitSha =
  process.env.NEXT_PUBLIC_GIT_SHA ??
  process.env.VERCEL_GIT_COMMIT_SHA ??
  process.env.GIT_COMMIT_SHA ??
  "";
const deployEnv =
  process.env.NEXT_PUBLIC_DEPLOY_ENV ??
  process.env.NODE_ENV ??
  "unknown";
const versionLabel = gitSha
  ? `v${appVersion}+${gitSha.slice(0, 7)}`
  : `v${appVersion}`;
const envLabel = deployEnv === "production" ? "prod" : deployEnv;
const currentYear = new Date().getFullYear();
const copyrightYear =
  currentYear > 2025
    ? `2025–${currentYear}`
    : "2025";

export default function Footer() {
  return (
    <div className="flex items-center justify-between text-xs text-muted-foreground">
      <span>© {copyrightYear} by gaertan.art | All rights reserved</span>
      <span>{versionLabel} · {envLabel}</span>
    </div>
  );
}
