import { detectLang } from '../messages/index.js';

const TO: Record<string, { label: string; href: string }> = {
  en: { label: 'en', href: '/ru' },
  ru: { label: 'ru', href: '/' },
};

export function LangSwitch() {
  const lang = detectLang();
  const { label, href } = TO[lang];

  return (
    <a
      href={href}
      style={{
        position: 'absolute',
        top: '8px',
        right: '12px',
        fontSize: '0.7rem',
        fontWeight: 'bold',
        color: '#787c7e',
        textDecoration: 'none',
        border: 'none',
        background: 'none',
        cursor: 'pointer',
        fontFamily: 'monospace',
        textTransform: 'uppercase',
      }}
    >
      {label}
    </a>
  );
}
