// Sparta-style element configurations
// Based on AC Sparta Praha design patterns from rec directory

import { PageElementConfig } from '../services/pageElements';

export const SPARTA_STYLE_ELEMENTS: PageElementConfig[] = [
  {
    page_type: 'homepage',
    element_name: 'header',
    variant: 'sparta_navbar',
    visible: true,
    display_order: 0,
    settings: {
      logo: '/images/sparta-logo.svg',
      logoWidth: 48,
      logoHeight: 48,
      searchEnabled: true,
      authEnabled: true,
      burgerMenu: true,
      links: [
        { label: 'Vstupenky', url: '/vstupenky', variant: 'tertiary' },
        { label: 'Fanzone', url: '/fanzone', variant: 'tertiary' },
      ],
    },
  },
  {
    page_type: 'homepage',
    element_name: 'hero',
    variant: 'sparta_featured_carousel',
    visible: true,
    display_order: 1,
    settings: {
      autoSwap: true,
      swapInterval: 5000,
      showThumbnails: true,
      thumbnailCount: 4,
      showCategories: true,
      buttonLabel: 'Přehrát',
      buttonVariant: 'primary',
      height: {
        mobile: '42.375rem',
        tablet: '50rem',
        desktop: '53rem',
      },
      gradientOverlay: true,
    },
  },
  {
    page_type: 'homepage',
    element_name: 'videos',
    variant: 'sparta_horizontal_slider',
    visible: true,
    display_order: 2,
    settings: {
      title: 'Videa',
      titleLink: '/sparta-tv',
      itemsPerView: {
        mobile: 1,
        tablet: 2,
        desktop: 3,
      },
      gap: 16,
      showControls: true,
      enableDrag: true,
      showUnlimitedBadge: true,
      showCategories: true,
      showDuration: true,
    },
  },
  {
    page_type: 'homepage',
    element_name: 'team',
    variant: 'sparta_tabs_stats',
    visible: true,
    display_order: 3,
    settings: {
      title: 'Týmy',
      titleLink: '/tymy',
      tabs: [
        { id: '1', label: 'Muži A', value: '1' },
        { id: '3', label: 'Ženy A', value: '3' },
        { id: '25', label: 'Muži B', value: '25' },
      ],
      showBuyJersey: true,
      buyJerseyUrl: 'https://www.fnshp.cz/ac-sparta-praha',
      showTeamDetails: true,
      backgroundColor: 'var(--colorBgSecondary, #1e1e1e)',
      padding: {
        mobile: '1.625rem 1.25rem',
        desktop: '2.5rem',
      },
    },
  },
  {
    page_type: 'homepage',
    element_name: 'merch',
    variant: 'sparta_product_slider',
    visible: true,
    display_order: 4,
    settings: {
      title: 'Fanshop',
      titleLink: 'https://www.fnshp.cz/ac-sparta-praha',
      externalLink: true,
      itemsPerView: {
        mobile: 1,
        tablet: 2,
        desktop: 4,
      },
      gap: 16,
      showControls: true,
      enableDrag: true,
      currency: 'Kč',
      showPrices: true,
      buyButtonLabel: 'Koupit',
    },
  },
  {
    page_type: 'homepage',
    element_name: 'sponsors',
    variant: 'sparta_partners_pyramid',
    visible: true,
    display_order: 5,
    settings: {
      pyramidTiers: 3,
      topTierCount: 1,
      middleTierCount: 4,
      bottomTierCount: 8,
      imageFormat: 'svg',
      partners: {
        top: [
          { name: 'Betano', logo: '/images/svg/footer/betano.svg', url: 'https://www.betano.cz/' },
        ],
        middle: [
          { name: 'EPET', logo: '/images/svg/footer/epet.svg', url: 'https://www.epet.cz/' },
          { name: 'Adidas', logo: '/images/svg/footer/adidas.svg', url: 'https://www.adidas.cz/obuv-fotbal' },
          { name: 'T-Mobile', logo: '/images/svg/footer/t-mobile.svg', url: 'https://www.t-mobile.cz/' },
          { name: 'Chance Liga', logo: '/images/svg/footer/chance.svg', url: 'https://www.chanceliga.cz/' },
        ],
        bottom: [
          { name: 'ČSOB', logo: '/images/svg/footer/csob.svg', url: 'https://www.csob.cz/' },
          { name: 'Renomia', logo: '/images/svg/footer/renomia.svg', url: 'https://www.renomia.cz/' },
          // Add more partners as needed
        ],
      },
    },
  },
  {
    page_type: 'homepage',
    element_name: 'footer',
    variant: 'sparta_extended',
    visible: true,
    display_order: 6,
    settings: {
      showPartners: true,
      showNewsletter: true,
      showSocial: true,
      showNavigation: true,
      columns: [
        {
          title: 'Klub',
          links: [
            { label: 'O klubu', url: '/o-klubu' },
            { label: 'Historie', url: '/historie' },
            { label: 'Kontakt', url: '/kontakt' },
          ],
        },
        {
          title: 'Týmy',
          links: [
            { label: 'Muži A', url: '/tymy/1' },
            { label: 'Ženy A', url: '/tymy/3' },
            { label: 'Mládež', url: '/tymy/mladez' },
          ],
        },
        {
          title: 'Fanshop',
          links: [
            { label: 'Dresy', url: 'https://www.fnshp.cz/dresy' },
            { label: 'Oblečení', url: 'https://www.fnshp.cz/obleceni' },
            { label: 'Doplňky', url: 'https://www.fnshp.cz/doplnky' },
          ],
        },
      ],
    },
  },
];

// Additional utility function to merge Sparta elements with defaults
export const mergeSpartaElements = (defaultElements: PageElementConfig[]): PageElementConfig[] => {
  const spartaElementMap = new Map(
    SPARTA_STYLE_ELEMENTS.map(el => [el.element_name, el])
  );

  return defaultElements.map(defaultEl => {
    const spartaEl = spartaElementMap.get(defaultEl.element_name);
    if (spartaEl) {
      return {
        ...defaultEl,
        variant: spartaEl.variant,
        settings: { ...defaultEl.settings, ...spartaEl.settings },
      };
    }
    return defaultEl;
  });
};
