type MatchConditionsCardProps = {
  matchId: string;
  strictnessIndex: number;
  heatIndex: number;
  cardsPressureAlert: boolean;
  secondHalfHomeAttack: number;
  secondHalfAwayAttack: number;
  secondHalfUnderRecommendation: boolean;
  attackerDirection: string;
};

export function MatchConditionsCard({
  matchId,
  strictnessIndex,
  heatIndex,
  cardsPressureAlert,
  secondHalfHomeAttack,
  secondHalfAwayAttack,
  secondHalfUnderRecommendation,
  attackerDirection,
}: MatchConditionsCardProps) {
  const isHeatCritical = heatIndex >= 32;
  const isStrict = strictnessIndex >= 80;
  const underSignal = secondHalfUnderRecommendation || cardsPressureAlert;

  return (
    <article className="panel-glow rounded-2xl p-4">
      <h3 className="dot-matrix text-lg text-[#7d2a15]">場次條件指標：{matchId}</h3>
      <div className="mt-3 space-y-2 text-sm text-[#6f4f3c]">
        <p>裁判嚴厲度：{strictnessIndex.toFixed(1)}</p>
        <p>Heat Index：{heatIndex.toFixed(1)} ℃</p>
        <p>下半場主隊攻勢調整：{secondHalfHomeAttack.toFixed(2)}</p>
        <p>下半場客隊攻勢調整：{secondHalfAwayAttack.toFixed(2)}</p>
        <p>攻守主導：{attackerDirection}</p>
      </div>

      <div
        className={`mt-4 rounded-xl border p-3 ${underSignal ? 'border-[#d1432d] bg-[#fff0e2]' : 'border-[#dcb53b] bg-[#fff8e6]'}`}
      >
        <p className="dot-matrix text-sm text-[#7d2a15]">條件結論</p>
        {cardsPressureAlert ? (
          <p className="mt-1 text-sm text-[#8c2f2f]">
            卡牌盤壓力信號：牌數上盤偏緊，需警惕莊家對高牌盤的保守估計
          </p>
        ) : null}
        {isHeatCritical ? (
          <p className="mt-1 text-sm text-[#8c2f2f]">
            高溫濕度加權：下半場容易偏慢，優先觀察 2H Under
          </p>
        ) : null}
        {isStrict ? (
          <p className="mt-1 text-sm text-[#8c2f2f]">審判尺度偏嚴，犯規型盤口策略需降風險。</p>
        ) : null}
        {!cardsPressureAlert && !isHeatCritical ? (
          <p className="mt-1 text-sm text-[#7a5b46]">目前條件可視為正常，未看到明顯單場偏差。</p>
        ) : null}
      </div>
    </article>
  );
}
