"use client";

import { useEffect } from "react";
import Container from "../elements/Container";

function Footer() {
  useEffect(() => {
    // اسکریپت زرین پال را داینامیک اضافه می‌کنیم
    const script = document.createElement("script");
    script.src = "https://www.zarinpal.com/webservice/TrustCode";
    script.type = "text/javascript";
    document.body.appendChild(script);

    return () => {
      document.body.removeChild(script);
    };
  }, []);

  const namad = `
    <a referrerpolicy="origin" target="_blank"
      href="https://trustseal.enamad.ir/?id=473306&Code=qBnrfMDzcAWMk5eh7qLR69OOq6qbNcU8">
      <img referrerpolicy="origin"
        src="https://trustseal.enamad.ir/logo.aspx?id=473306&Code=qBnrfMDzcAWMk5eh7qLR69OOq6qbNcU8"
        alt=""
        style="cursor:pointer"
      />
    </a>
  `;

  return (
    <Container>
      <div className="sticky top-0 bg-primary-light dark:bg-primary-dark z-[999] border-t">
        <div className="flex justify-between items-center px-8 py-4">
          <div dangerouslySetInnerHTML={{ __html: namad }} />

          <img
            id="rgvjjzpejzpesizpapfurgvj"
            referrerPolicy="origin"
            alt="logo-samandehi"
            src="https://logo.samandehi.ir/logo.aspx?id=377953&p=qftiyndtyndtbsiyujynqfti"
            style={{ cursor: "pointer" }}
            onClick={() =>
              window.open(
                "https://logo.samandehi.ir/Verify.aspx?id=377953&p=xlaojyoejyoepfvldshwxlao",
                "Popup",
                "toolbar=no, scrollbars=no, location=no, statusbar=no, menubar=no, resizable=0, width=450, height=630, top=30"
              )
            }
          />
        </div>
      </div>
    </Container>
  );
}

export default Footer;
