import { toCampusInfo } from '@/shared/constants/campusDisplay';
import type { CampusInfo } from '@/shared/types/app';
import type { CampusCatalogItem } from '@/shared/types/campuses';

export function toCampusCatalogViewModels(campuses: readonly CampusCatalogItem[]): readonly CampusInfo[] {
  return campuses.flatMap((campus) => {
    const campusInfo = toCampusInfo(campus);
    return campusInfo ? [campusInfo] : [];
  });
}
