import { StatusBadge } from "@/components/ui/badge";
import { EtaBadge } from "@/components/geo/eta-badge";
import { t } from "@/lib/i18n/de";
import type { EtaResult } from "@/lib/geo/types";
import type { SearchHit } from "@/lib/search/types";

export type EquipmentRowData = SearchHit & { eta?: EtaResult };

/** Eine Geräte-Trefferzeile (kein Funkrufname). */
export function EquipmentResultRow({ hit }: { hit: EquipmentRowData }) {
  return (
    <li className="flex items-center justify-between gap-4 border-b border-rand px-1 py-3 last:border-0">
      <a
        href={`/geraete/${hit.entityId}`}
        className="min-w-0 truncate font-medium text-navy hover:underline"
      >
        {hit.name}
      </a>
      <div className="flex shrink-0 items-center gap-2">
        <StatusBadge status={hit.status} />
        {hit.eta ? (
          <EtaBadge eta={hit.eta} />
        ) : (
          <span className="text-xs text-anthrazit/40">
            {t("search.eintreffzeitOffen")}
          </span>
        )}
      </div>
    </li>
  );
}
