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

type TenderAiSummarySectionProps = {
  tender: TTenderDetails;
};

export function TenderAiSummarySection({
  tender,
}: TenderAiSummarySectionProps) {
  if (!shouldShowAiSummarySection(tender)) return null;

  return (
    <div id={TENDER_SECTION_IDS.aiSummary} className={HEADER_SCROLL_MARGIN}>
      <SectionHeading>AI summary</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.overall_summary}
        </p>
      </div>
    </div>
  );
}
