import React, { useEffect, useState } from 'react';
import type { ReactElement } from 'react';
import Head from 'next/head';
import Link from 'next/link';
import { useAppSelector } from '../stores/hooks';
import LayoutGuest from '../layouts/Guest';
import WebSiteHeader from '../components/WebPageComponents/Header';
import WebSiteFooter from '../components/WebPageComponents/Footer';
import {
  HeroDesigns,
  FeaturesDesigns,
  TestimonialsDesigns,
  PricingDesigns,
} from '../components/WebPageComponents/designs';

import HeroSection from '../components/WebPageComponents/HeroComponent';

import FeaturesSection from '../components/WebPageComponents/FeaturesComponent';

import TestimonialsSection from '../components/WebPageComponents/TestimonialsComponent';

import PricingSection from '../components/WebPageComponents/PricingComponent';

export default function WebSite() {
  const cardsStyle = useAppSelector((state) => state.style.cardsStyle);
  const bgColor = useAppSelector((state) => state.style.bgLayoutColor);
  const projectName = 'kartiGO';

  useEffect(() => {
    const darkElement = document.querySelector('body .dark');
    if (darkElement) {
      darkElement.classList.remove('dark');
    }
  }, []);
  const pages = [
    {
      href: '/home',
      label: 'home',
    },

    {
      href: '/products',
      label: 'products',
    },

    {
      href: '/contact',
      label: 'contact',
    },
  ];

  const features_points = [
    {
      name: 'Vast Product Selection',
      description:
        'Browse through an extensive range of products across various categories, ensuring you find exactly what you need.',
      icon: 'mdiCartOutline',
    },
    {
      name: 'Secure Payment Options',
      description:
        'Enjoy peace of mind with our secure payment gateways, offering multiple options for a safe and convenient checkout.',
      icon: 'mdiLock',
    },
    {
      name: 'Personalized Recommendations',
      description:
        'Receive tailored product suggestions based on your preferences and shopping history, enhancing your shopping experience.',
      icon: 'mdiAccountCircle',
    },
  ];

  const testimonials = [
    {
      text: 'Shopping on ${projectName} has been a game-changer for me. The variety and quality of products are unmatched!',
      company: 'TechNova Solutions',
      user_name: 'Alex Johnson, Product Manager',
    },
    {
      text: "I love the personalized recommendations. It's like having a personal shopper who knows exactly what I need.",
      company: 'GreenLeaf Enterprises',
      user_name: 'Samantha Green, Marketing Director',
    },
    {
      text: 'The secure payment options give me peace of mind every time I shop. Highly recommend ${projectName}!',
      company: 'SecurePay Inc.',
      user_name: 'Michael Brown, CFO',
    },
    {
      text: 'Fast shipping and excellent customer service. ${projectName} has become my go-to online store.',
      company: 'QuickShip Logistics',
      user_name: 'Emily White, Operations Manager',
    },
    {
      text: 'The user-friendly interface makes shopping a breeze. I can find what I need in no time.',
      company: 'EaseTech Innovations',
      user_name: 'David Lee, UX Designer',
    },
    {
      text: 'I appreciate the detailed product descriptions and reviews. It helps me make informed decisions.',
      company: 'InfoHub Corp.',
      user_name: 'Jessica Taylor, Content Strategist',
    },
  ];

  const pricing_features = {
    standard: {
      features: [
        'Access to all product categories',
        'Secure payment options',
        'Basic customer support',
      ],
      limited_features: [
        'Limited personalized recommendations',
        'Limited order tracking',
      ],
    },
    premium: {
      features: [
        'Access to all product categories',
        'Secure payment options',
        'Priority customer support',
      ],
      also_included: [
        'Advanced personalized recommendations',
        'Comprehensive order tracking',
        'Exclusive discounts',
      ],
    },
    business: {
      features: [
        'Access to all product categories',
        'Secure payment options',
        'Dedicated account manager',
        'Advanced analytics and reporting',
        'Customizable solutions',
      ],
    },
  };

  const description = {
    standard:
      'The Standard plan is perfect for individuals who want a straightforward shopping experience with essential features.',
    premium:
      'The Premium plan is ideal for small startups or agencies looking for enhanced features and priority support to boost their shopping efficiency.',
    business:
      'The Business plan is designed for enterprises seeking comprehensive solutions, advanced analytics, and dedicated support to meet their large-scale needs.',
  };

  return (
    <div className='flex flex-col min-h-screen'>
      <Head>
        <title>{`Welcome to Our E-commerce Platform`}</title>
        <meta
          name='description'
          content={`Discover a wide range of products, exclusive deals, and seamless shopping experience on our e-commerce platform. Shop now and enjoy the best online shopping experience.`}
        />
      </Head>
      <WebSiteHeader projectName={'kartiGO'} pages={pages} />
      <main className={`flex-grow  ${bgColor}    rounded-none  `}>
        <HeroSection
          projectName={'kartiGO'}
          image={['Diverse shopping items displayed']}
          mainText={`Discover Your Next Favorite Product at ${projectName}`}
          subTitle={`Explore a vast selection of products tailored to your needs. Enjoy seamless shopping and exclusive deals on ${projectName}.`}
          design={HeroDesigns.IMAGE_BG || ''}
          buttonText={`Start Shopping`}
        />

        <FeaturesSection
          projectName={'kartiGO'}
          image={['Icons representing key features']}
          withBg={1}
          features={features_points}
          mainText={`Explore Key Features of ${projectName}`}
          subTitle={`Discover the powerful features that make shopping on ${projectName} a seamless and enjoyable experience.`}
          design={FeaturesDesigns.CARDS_GRID_WITH_ICONS || ''}
        />

        <TestimonialsSection
          projectName={'kartiGO'}
          design={TestimonialsDesigns.MULTI_CARD_DISPLAY || ''}
          testimonials={testimonials}
          mainText={`What Our Customers Say About ${projectName} `}
        />

        <PricingSection
          projectName={'kartiGO'}
          withBg={1}
          features={pricing_features}
          description={description}
        />
      </main>
      <WebSiteFooter projectName={'kartiGO'} pages={pages} />
    </div>
  );
}

WebSite.getLayout = function getLayout(page: ReactElement) {
  return <LayoutGuest>{page}</LayoutGuest>;
};
