import type { MothershipAddressCandidate } from "@/lib/frontend/types";
import { sortMothershipCandidatesForDraft } from "@/lib/address/street-normalize";

/** 从候选列表中按门牌号/城市/街道词打分，避免误选 Bridge 等歧义项 */
export function pickBestMothershipCandidate(
  candidates: MothershipAddressCandidate[],
  draft: { street: string; city: string; state: string },
): MothershipAddressCandidate | undefined {
  if (!candidates.length) {
    return undefined;
  }
  return sortMothershipCandidatesForDraft(candidates, draft)[0];
}
