import { AlertTriangle, CheckCircle2, CircleDashed } from "lucide-react";

import { Badge } from "@/components/ui/Badge";
import { Button } from "@/components/ui/Button";

interface ReviewSummaryRailProps {
  conflictCount: number;
  unresolvedCount: number;
  reviewing: boolean;
  hasReport: boolean;
  onNextUnresolved: () => void;
}

export function ReviewSummaryRail({
  conflictCount,
  unresolvedCount,
  reviewing,
  hasReport,
  onNextUnresolved,
}: ReviewSummaryRailProps) {
  return (
    <section className="sticky top-0 z-10 -mx-4 mb-4 border-b border-line bg-panel px-4 pb-3">
      <div className="flex items-center justify-between gap-3">
        <div>
          <h2 className="font-serif text-base text-ink">审稿摘要</h2>
          <p className="mt-1 text-xs text-ink-soft">
            {reviewing
              ? "四审正在更新"
              : hasReport
                ? "先处理未裁决冲突，再验收本章"
                : "暂无审稿留痕，可先重新审稿"}
          </p>
        </div>
        {reviewing ? (
          <Badge variant="info">
            <CircleDashed className="h-3 w-3" aria-hidden="true" />
            审稿中
          </Badge>
        ) : unresolvedCount > 0 ? (
          <Badge variant="danger">
            <AlertTriangle className="h-3 w-3" aria-hidden="true" />
            {unresolvedCount}/{conflictCount} 待裁决
          </Badge>
        ) : conflictCount > 0 ? (
          <Badge variant="success">
            <CheckCircle2 className="h-3 w-3" aria-hidden="true" />
            已裁决
          </Badge>
        ) : (
          <Badge variant={hasReport ? "success" : "neutral"}>
            {hasReport ? "无冲突" : "未审稿"}
          </Badge>
        )}
      </div>
      <Button
        onClick={onNextUnresolved}
        disabled={unresolvedCount === 0}
        variant="secondary"
        className="mt-3 w-full"
      >
        跳到下一条未裁决
      </Button>
    </section>
  );
}
