import Link from "next/link";
import { Plus } from "lucide-react";
import { Button } from "@/components/ui/button";
import { AssessmentList } from "@/components/risk-assessment/assessment-list";
import { getAssessments } from "@/actions/risk-assessment";

export default async function RiskAssessmentPage() {
  const assessments = await getAssessments();

  return (
    <div className="space-y-6">
      <div className="flex items-center justify-between">
        <div>
          <h2 className="text-2xl font-bold tracking-tight">위험성평가</h2>
          <p className="text-muted-foreground">
            작업별 위험성평가를 관리합니다.
          </p>
        </div>
        <Button asChild>
          <Link href="/risk-assessment/new">
            <Plus className="h-4 w-4 mr-2" />새 평가
          </Link>
        </Button>
      </div>
      <AssessmentList assessments={assessments} />
    </div>
  );
}
