import RelatedLinks, { type RelatedLink } from '@/components/RelatedLinks';
import { getCategoryIcon } from '@/lib/categoryIcons';
import { useT } from '@/lib/i18n';

const CATS: Record<string, { label: [string, string]; description: [string, string] }> = {
  peptides: { label: ['Alle peptides', 'All peptides'], description: ['Het volledige assortiment research peptides.', 'The full range of research peptides.'] },
  gewichtsbeheer: { label: ['Gewichtsbeheer & GLP-1', 'Weight Management & GLP-1'], description: ['Semaglutide, Tirzepatide, Retatrutide en meer.', 'Semaglutide, Tirzepatide, Retatrutide and more.'] },
  vetverbranding: { label: ['Vetverbranding & metabolisme', 'Fat Burning & Metabolism'], description: ['HGH Fragment, MOTS-c, NAD+ en Lean Stack.', 'HGH Fragment, MOTS-c, NAD+ and Lean Stack.'] },
  spiergroei: { label: ['Spiergroei', 'Muscle Growth'], description: ['Groeihormoon en secretagogen zoals CJC-1295 en Ipamorelin.', 'Growth hormone and secretagogues such as CJC-1295 and Ipamorelin.'] },
  'herstel-weefsel': { label: ['Herstel & weefsel', 'Recovery & Tissue'], description: ['BPC-157, TB-500 en de Wolverine Stack.', 'BPC-157, TB-500 and the Wolverine Stack.'] },
  'haar-huid': { label: ['Haar & huid', 'Hair & Skin'], description: ['GHK-Cu, Epithalon, Melanotan en Glow Stack.', 'GHK-Cu, Epithalon, Melanotan and Glow Stack.'] },
  libido: { label: ['Libido', 'Libido'], description: ['PT-141 voor onderzoek naar libido.', 'PT-141 for libido research.'] },
  'nakuur-pct': { label: ['Nakuur & PCT', 'PCT'], description: ['HCG voor onderzoek na een kuur.', 'HCG for post-cycle research.'] },
  'stacks-kits': { label: ['Stacks & Kits', 'Stacks & Kits'], description: ['Voordelige combinaties van peptides.', 'Cost-effective peptide combinations.'] },
  benodigdheden: { label: ['Benodigdheden', 'Supplies'], description: ['Water voor injectie en insulinespuiten.', 'Water for injection and insulin syringes.'] },
};

const RELATED: Record<string, string[]> = {
  peptides: ['gewichtsbeheer', 'spiergroei', 'herstel-weefsel', 'stacks-kits'],
  gewichtsbeheer: ['vetverbranding', 'stacks-kits', 'benodigdheden', 'peptides'],
  vetverbranding: ['gewichtsbeheer', 'spiergroei', 'stacks-kits', 'benodigdheden'],
  spiergroei: ['herstel-weefsel', 'vetverbranding', 'nakuur-pct', 'stacks-kits'],
  'herstel-weefsel': ['spiergroei', 'haar-huid', 'stacks-kits', 'benodigdheden'],
  'haar-huid': ['herstel-weefsel', 'libido', 'stacks-kits', 'peptides'],
  libido: ['haar-huid', 'nakuur-pct', 'peptides', 'benodigdheden'],
  'nakuur-pct': ['spiergroei', 'libido', 'benodigdheden', 'peptides'],
  'stacks-kits': ['spiergroei', 'herstel-weefsel', 'gewichtsbeheer', 'benodigdheden'],
  benodigdheden: ['peptides', 'gewichtsbeheer', 'spiergroei', 'stacks-kits'],
};

const DEFAULT = ['peptides', 'gewichtsbeheer', 'spiergroei', 'stacks-kits'];

export default function RelatedCategories({ slug }: { slug: string }) {
  const t = useT();
  const links: RelatedLink[] = (RELATED[slug] ?? DEFAULT)
    .filter((s) => s !== slug && CATS[s])
    .map((s) => ({
      to: `/product-category/${s}`,
      label: t(...CATS[s].label),
      description: t(...CATS[s].description),
      icon: getCategoryIcon(s),
    }));
  return (
    <RelatedLinks
      title={t('Verwante categorieën', 'Related categories')}
      subtitle={t('Bekijk ook deze productgroepen', 'Also check out these product groups')}
      ariaLabel={t('Verwante categorieën', 'Related categories')}
      links={links}
    />
  );
}
