import { requireWehrAdmin } from "@/lib/auth/guards";
import { getBrigade } from "@/server/data/vehicles";
import { de } from "@/lib/i18n/de";
import { BrigadeProfileForm } from "@/components/verwaltung/BrigadeProfileForm";

export default async function ProfilPage() {
  const s = await requireWehrAdmin();
  const b = await getBrigade(s.user.brigadeId);

  return (
    <div className="space-y-6">
      <header>
        <h1 className="font-display text-2xl font-semibold text-navy">
          {de.verwaltung.profilTitel}
        </h1>
        {b ? (
          <p className="mt-1 text-sm text-anthrazit/70">{b.name}</p>
        ) : null}
      </header>
      <BrigadeProfileForm
        initial={{
          strasse: b?.strasse ?? "",
          plz: b?.plz ?? "",
          ort: b?.ort ?? "",
          telefon: b?.telefon ?? "",
          email: b?.email ?? "",
          wehrfuehrer: b?.wehrfuehrer ?? "",
          funkrufnameSchema: b?.funkrufnameSchema ?? "",
        }}
      />
    </div>
  );
}
