// B2b — per-profile energy-label override resolver.
//
// The global labels live in `settings.energyLabels`; a Profile may set
// `energyLabelsOverride` to take precedence within its context. This
// helper centralises the lookup so callers never have to remember the
// "profile beats global, missing override is fine" precedence.
//
// B3.6 will add the editing UI; this batch ships the schema + resolver
// only so other features can already read through it without changing
// behaviour.

import type { EnergyLabels, Profile, SettingsState } from "$lib/types/app";

export function resolveEnergyLabels(
  profile: Profile | null | undefined,
  settings: SettingsState,
): EnergyLabels {
  return profile?.energyLabelsOverride ?? settings.energyLabels;
}
