import Image from "next/image";
import { BriefcaseIcon, ClockIcon, MapPinOutlineIcon } from "@/components/icons";

type JobSummaryCardProps = {
  title: string;
  department: string;
  location: string;
  type: string;
  experience: string;
  image: string;
  imageAlt: string;
  privacyNote: string;
};

/** Sidebar of a job application (Figma, 320px): job photo, icon, title, department, place / type / experience, privacy note. */
export function JobSummaryCard({ title, department, location, type, experience, image, imageAlt, privacyNote }: JobSummaryCardProps) {
  const rows = [
    { icon: MapPinOutlineIcon, label: location },
    { icon: ClockIcon, label: type },
    { icon: BriefcaseIcon, label: experience },
  ];

  return (
    <aside className="flex w-full shrink-0 flex-col gap-10 lg:w-80">
      <div className="overflow-hidden rounded-2xl border border-white/7 bg-primary/20">
        <div className="relative h-40">
          <Image src={image} alt={imageAlt} fill sizes="(min-width: 1024px) 320px, 100vw" className="object-cover" />
        </div>
        <div className="flex flex-col gap-5 px-6 pt-5">
          <span className="flex size-12 items-center justify-center rounded-full border border-white/10 bg-accent-violet/20 text-accent-violet-light">
            <BriefcaseIcon className="size-[22px]" />
          </span>
          <div className="pb-5">
            <h2 className="text-xl leading-7 font-semibold text-white">{title}</h2>
            <p className="pt-2 text-xs leading-4 font-medium text-soft">{department}</p>
          </div>
        </div>
        <ul className="flex flex-col gap-3 border-t border-white/7 p-5 text-xs leading-4 text-soft">
          {rows.map(({ icon: Icon, label }) => (
            <li key={label} className="flex items-center gap-2">
              <Icon className="size-3.5 shrink-0" />
              {label}
            </li>
          ))}
        </ul>
      </div>
      <p className="rounded-2xl border border-white/7 bg-white/10 p-4 text-xs leading-6 text-soft">{privacyNote}</p>
    </aside>
  );
}
