import { cn } from "@/lib/utils";

// Platform currencies: Georgian Lari (GEL, ₾) and Wild Georgia Coin (WGC).
// Prices in the mock data are still authored in USD-ish numeric units and
// treated 1:1 with GEL for display in this frontend-only build.
export const GEL_PER_UNIT = 1;
export const WGC_PER_GEL = 100; // 1 GEL = 100 WGC (Wild Georgia Coin)

export function toGEL(n: number) {
  return n * GEL_PER_UNIT;
}
export function toWGC(gel: number) {
  return Math.round(gel * WGC_PER_GEL);
}

export function formatGEL(n: number, opts: { withSymbol?: boolean } = { withSymbol: true }) {
  const rounded = (Math.round(n * 100) / 100).toFixed(2);
  return opts.withSymbol ? `${rounded} ₾` : rounded;
}

export function formatWGC(n: number) {
  return `${Math.round(n).toLocaleString()} WGC`;
}

// Compact inline SVG marks — no external assets.
export function LariMark({ className }: { className?: string }) {
  return (
    <svg viewBox="0 0 24 24" className={cn("h-4 w-4", className)} aria-hidden>
      <path
        fill="currentColor"
        d="M13 3v3.2c2.3.5 4 2.5 4 4.8h-2.5c0-1.3-.9-2.4-2.5-2.7V15c0 1.7 1.3 3 3 3h1v2.5h-1c-3 0-5.5-2.5-5.5-5.5V8.3C7.8 8.6 6 10.3 6 12.5H3.5C3.5 8.9 6.4 6 10 6V3h3Z"
      />
    </svg>
  );
}

export function WGCMark({ className }: { className?: string }) {
  return (
    <svg viewBox="0 0 24 24" className={cn("h-4 w-4", className)} aria-hidden>
      <defs>
        <linearGradient id="wgc-g" x1="0" x2="1" y1="0" y2="1">
          <stop offset="0" stopColor="var(--color-primary)" />
          <stop offset="1" stopColor="var(--color-secondary)" />
        </linearGradient>
      </defs>
      <circle cx="12" cy="12" r="10" fill="url(#wgc-g)" />
      <circle cx="12" cy="12" r="7.5" fill="none" stroke="rgba(255,255,255,0.35)" strokeWidth="1" />
      <text
        x="12"
        y="15"
        textAnchor="middle"
        fontFamily="var(--font-display)"
        fontWeight="800"
        fontSize="8"
        fill="#fff"
      >
        W
      </text>
    </svg>
  );
}