import Link from "next/link";
import { requireSession } from "@/lib/session-helpers";

export default async function PortalLayout({ children }: { children: React.ReactNode }) {
  const session = await requireSession();

  return (
    <section className="section">
      <div className="container layout-split">
        <aside className="side-nav" aria-label="Mitgliederbereich">
          <strong style={{ display: "block", padding: "0.35rem 0.65rem", marginBottom: "0.35rem" }}>
            Mitgliederbereich
          </strong>
          <Link href="/portal">Übersicht</Link>
          <Link href="/portal/account">Konto &amp; Passwort</Link>
          <Link href="/portal/certificates">Zertifikate</Link>
          <Link href="/kurse">Kurskatalog</Link>
          {session.user.role === "ADMIN" ? <Link href="/admin">Administration</Link> : null}
          <Link href="/">Startseite</Link>
        </aside>
        <div>{children}</div>
      </div>
    </section>
  );
}
