/**
 * SEO Component
 * Uses react-helmet-async to manage meta tags for marketing pages
 */

import React from "react";
import { Helmet } from "react-helmet-async";
import { MetaTags } from "../config/metaTags";

interface SEOProps {
  meta: MetaTags;
}

const SEO: React.FC<SEOProps> = ({ meta }) => {
  const {
    title,
    description,
    keywords,
    ogTitle,
    ogDescription,
    ogImage,
    twitterCard,
    twitterTitle,
    twitterDescription,
  } = meta;

  return (
    <Helmet>
      {/* Primary Meta Tags */}
      <title>{title}</title>
      <meta name="title" content={title} />
      <meta name="description" content={description} />
      <meta name="keywords" content={keywords} />

      {/* Open Graph / Facebook */}
      <meta property="og:type" content="website" />
      <meta property="og:url" content="https://igny8.com" />
      <meta property="og:title" content={ogTitle || title} />
      <meta property="og:description" content={ogDescription || description} />
      {ogImage && <meta property="og:image" content={ogImage} />}

      {/* Twitter */}
      <meta property="twitter:card" content={twitterCard || "summary_large_image"} />
      <meta property="twitter:url" content="https://igny8.com" />
      <meta property="twitter:title" content={twitterTitle || ogTitle || title} />
      <meta property="twitter:description" content={twitterDescription || ogDescription || description} />
      {ogImage && <meta property="twitter:image" content={ogImage} />}

      {/* Additional SEO */}
      <meta name="robots" content="index, follow" />
      <meta name="language" content="English" />
      <meta name="author" content="IGNY8" />
    </Helmet>
  );
};

export default SEO;

