import type { ElementType } from "react";
import { FileText, Shield, Activity, BarChart3 } from "lucide-react";

export function round(value: number, decimals = 1): number {
  const factor = Math.pow(10, decimals);
  return Math.round(value * factor) / factor;
}

export function getStatusColor(score: number): string {
  if (score >= 70) return "text-green-500";
  if (score >= 40) return "text-yellow-500";
  return "text-red-500";
}

export function getProgressBg(score: number): string {
  if (score >= 70) return "bg-green-500";
  if (score >= 40) return "bg-yellow-500";
  return "bg-red-500";
}

export const DIMENSION_ICONS: Record<string, ElementType> = {
  "内容可提取性": FileText,
  "E-E-A-T信号": Shield,
  "引用就绪度": Activity,
  "结构化数据": BarChart3,
  "语义一致性": Shield,
  "技术可访问性": Activity,
};
