/**
 * Extracts simplified address list from OS Places response.
 */
export function formatOsResults(apiResponse: any) {
  if (!apiResponse?.results) return [];

  return apiResponse.results
    .map((entry: any) => {
      const dpa = entry.DPA;
      if (!dpa) return null;

      return {
        uprn: dpa.UPRN,
        address: dpa.ADDRESS,
      };
    })
    .filter(Boolean);
}
