import { ArrowRightLeft } from "lucide-react";
import type { PractitionerRecommendation } from "../../../../../utils/booking/matchPractitionerSuggestions";
interface PractitionerRecommendationCalloutProps {
recommendations: PractitionerRecommendation[];
onSelect: (rec: PractitionerRecommendation) => void;
// "your reason" is written to the person the visit is FOR. The front desk is booking on somebody
// else's behalf, so the same sentence there addresses the wrong person. One component with one
// overridable line, rather than a second copy of this that drifts.
label?: string;
}
// "Recommended for your reason" - the practitioner-matching counterpart to "Find my
// service" suggestion cards (reason-for-visit -> suggested service, see PatientBookAppointment.tsx's
// `suggestions.map(...)` block). Same idiom: a ranked, tappable card with a one-line "why", mirrored
// here for PRACTITIONER recommendations instead of services. Purely presentational - the whole row
// IS the button (no separate "switch" control); the parent (Task 7) owns location-filter/select-state
// side effects when it handles onSelect. Fails open to null on an empty list (leaf-level, never blocks
// the manual practitioner picker it sits above).
//
// A practitioner can reach this list with no specialty recorded - a patient who asks for somebody by
// name gets them whether or not the practice ever filled that field in - so the specialty line and its
// separator are rendered only when there is one.
const PractitionerRecommendationCallout = ({
recommendations,
onSelect,
label = "Recommended for your reason",
}: PractitionerRecommendationCalloutProps) => {
if (recommendations.length === 0) {
return null;
}
const [primary, ...rest] = recommendations;
const renderLocation = (rec: PractitionerRecommendation) =>
rec.crossLocation ? (
{`at ${rec.locationDisplay} — switch`}
) : (
{rec.locationDisplay}
);
return (
/* A group, not a label: what follows is a set of suggestion BUTTONS, and a