import type { TTenderDetails } from "@/lib/api/types/Tenders";
import { HEADER_SCROLL_MARGIN, TENDER_SECTION_IDS } from "../constants";
import { shouldShowDescriptionSection } from "../tender-display-utils";
import { SectionHeading } from "./section-heading";

type TenderDescriptionSectionProps = {
  tender: TTenderDetails;
};

export function TenderDescriptionSection({
  tender,
}: TenderDescriptionSectionProps) {
  if (!shouldShowDescriptionSection(tender)) return null;

  return (
    <div id={TENDER_SECTION_IDS.description} className={HEADER_SCROLL_MARGIN}>
      <SectionHeading>Description</SectionHeading>
      <div className="rounded-2xl border border-stroke/60 bg-gray-2/40 p-6 shadow-inner dark:border-dark-3 dark:bg-dark-3/30">
        <p className="whitespace-pre-wrap text-sm leading-relaxed text-dark dark:text-white/90">
          {tender.description}
        </p>
      </div>
    </div>
  );
}
