import Link from "next/link";
import type { NoteDetail } from "@/lib/types";

export function MetadataPanel({ note }: { note: NoteDetail }) {
  return (
    <section className="surface-card" style={{ padding: "var(--nl-space-5)", display: "grid", gap: "var(--nl-space-3)" }}>
      <div style={{ fontWeight: 700 }}>Metadata</div>
      <div style={{ display: "grid", gap: "var(--nl-space-2)" }}>
        <div style={{ color: "var(--nl-text-secondary)" }}>Owner: {note.metadata.owner}</div>
        <div style={{ color: "var(--nl-text-secondary)" }}>Source: {note.metadata.source}</div>
        <Link href="/reviews" style={{ color: "var(--nl-text-secondary)" }}>
          Review state: {note.metadata.reviewState}
        </Link>
        <div style={{ color: "var(--nl-text-secondary)" }}>Tasks: {note.metadata.taskCount}</div>
        <div style={{ color: "var(--nl-text-secondary)" }}>Artifacts: {note.metadata.artifactCount}</div>
      </div>
      <div style={{ display: "flex", gap: "var(--nl-space-2)", flexWrap: "wrap" }}>
        {note.tags.map((tag) => (
          <Link key={tag} href={`/search?q=${encodeURIComponent(tag)}`} className="badge">
            #{tag}
          </Link>
        ))}
      </div>
    </section>
  );
}
