"use client";

/**
 * BuySignalCard — bottom-grid «Buy Signal» gauge. Derived from the §22 forecast
 * exec-summary deficit_index (same logic as the invest-score buy-signal): >0.05
 * приобретать / <−0.05 пропустить / else наблюдать. Advisory (§22). While the
 * forecast is pending the gauge shows the honest «после прогноза» placeholder.
 */

import styles from "@/app/site-finder/analysis/[cad]/ptica/ptica.module.css";
import type { ForecastReport } from "@/types/forecast";
import { BuildabilityGauge } from "@/components/site-finder/ptica/BuildabilityGauge";
import { adaptBuySignalGauge } from "@/components/site-finder/ptica/ptica-adapt";

interface Props {
  forecastReport?: ForecastReport;
}

export function BuySignalCard({ forecastReport }: Props) {
  const { gauge } = adaptBuySignalGauge(forecastReport);

  return (
    <div className={`${styles.card} ${styles.buySignalCard}`}>
      <h3 className={`${styles.cardTitle} ${styles.buySignalTitle}`}>
        Buy Signal
      </h3>
      <BuildabilityGauge gauge={gauge} title="" />
    </div>
  );
}
