import Image from "next/image";
import Link from "next/link";
import BarNavigation from "../BarNavigation/BarNavigation";
import header from "./Header.module.css";
import { cookies } from "next/headers";
import BarNavigationServicio from "../BarNavigation/BarNavigationServicio";

export default async function Header() {
  const cookieStore = await cookies();
  const role = cookieStore.get("role")?.value || "";

  return (
    <header className={header.header}>
      <Link
        href="https://www.unam.mx/"
        target="_blank"
        className={header.center}
        style={{ display: "flex", alignItems: "center", margin: "10px 5px" }}
      >
        <div className={header.logoContainer}>
          <Image
            className={header.logo}
            src="/logo_fes.png"
            alt="Logo FES"
            fill
            style={{ objectFit: "contain" }}
          />
        </div>
      </Link>
      <div className={header.yellowPart}></div>
      <div className={header.containerBarNav}>
        {role === "ADMINIS.TRADOR" && <BarNavigation />}
        {role === "SUPER ADMINISTRADOR   (quita sanciones)" && <BarNavigation />}
        {role === "ADMINISTRADOR" && <BarNavigation/>}
        {role === "ATENCION A USUARIO" && <BarNavigation/>}
        {role === "SERVICIO SOCIAL" && <BarNavigationServicio/>}
      </div>
    </header>
  );
}
