import Layout from "@/components/layout/Layout";
import Link from "next/link";
import { notFound } from "next/navigation";
import { areaOfInjuryData } from "@/utils/AreaOfInjery.utils";

export async function generateStaticParams() {
  return areaOfInjuryData.map((item) => ({
    slug: item.slug,
  }));
}

export default function AreaOfInjuryDetails({ params }) {
  const service = areaOfInjuryData.find((item) => item.slug === params.slug);

  if (!service) return notFound();

  return (
    <Layout
      headerStyle={2}
      footerStyle={1}
      breadcrumbTitle={service.title}
      bannerImage={service.bannerImage}
    >
      <section className="service-details pt_120 pb_120">
        <div className="auto-container">
          <div className="row clearfix">
            {/* Sidebar */}
            <div className="col-lg-4 col-md-12 col-sm-12 sidebar-side">
              <div className="default-sidebar service-sidebar mr_15">
                {/* Categories */}
                <div className="sidebar-widget category-widget">
                  <div className="widget-title">
                    <h3>Area Of Injury</h3>
                  </div>
                  <div className="widget-content">
                    <ul className="category-list clearfix">
                      {areaOfInjuryData.map((cat) => (
                        <li key={cat.id}>
                          <Link
                            href={`/area-of-injury/${cat.slug}`}
                            className={cat.slug === service.slug ? "current" : ""}
                          >
                            {cat.title}
                          </Link>
                        </li>
                      ))}
                    </ul>
                  </div>
                </div>

                {/* Sidebar Service Card */}
                <div className="service-block-one">
                  <div className="inner-box">
                    <div className="image-box">
                      <figure className="image">
                        <img src={service.image} alt={service.title} />
                      </figure>
                    </div>
                    <div className="lower-content">
                      <div className="icon-box">
                        <img src={service.icon} alt={`${service.title} Icon`} />
                      </div>
                      <h3>{service.title}</h3>
                      <p>{service.shortDescription}</p>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            {/* Main Content */}
            <div className="col-lg-8 col-md-12 col-sm-12 content-side">
              <div className="service-details-content">
                <div className="content-one mb_60">
                  {/* Main Image */}
                  <figure className="image-box mb_40">
                    <img src={service.mainImage} alt={service.title} />
                  </figure>
                  <div className="text-box">
                    <h2>{service.title}</h2>
                  </div>

                  {/* Dynamic Content */}
                  <div
                    className="service-details-description"
                    dangerouslySetInnerHTML={{ __html: service.content }}
                  />
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>

      {/* Subscribe Section */}
      {/* <section className="subscribe-section">
        <div className="auto-container">
          <div className="inner-container">
            <div className="row align-items-center">
              <div className="col-lg-6 col-md-12 col-sm-12 text-column">
                <div className="text-box">
                  <h2>
                    <span>Subscribe</span> for the exclusive updates!
                  </h2>
                </div>
              </div>
              <div className="col-lg-6 col-md-12 col-sm-12 form-column">
                <div className="form-inner">
                  <form method="post" action="contact">
                    <div className="form-group">
                      <input
                        type="email"
                        name="email"
                        placeholder="Enter Your Email Address"
                        required
                      />
                      <button type="submit" className="theme-btn btn-one">
                        <span>Subscribe Now</span>
                      </button>
                    </div>
                    <div className="form-group">
                      <div className="check-box">
                        <input className="check" type="checkbox" id="checkbox1" />
                        <label htmlFor="checkbox1">
                          I agree to the <Link href="/">Privacy Policy.</Link>
                        </label>
                      </div>
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section> */}
    </Layout>
  );
}
