export type ProductTierLabelKey =
  | "productTier.freeEdition"
  | "productTier.sharedWebmail"
  | "productTier.zimbraNative"
  | "productTier.googleConnect";

export function resolveProductTierLabelKey(tier?: string, edition?: string): ProductTierLabelKey {
  const normalizedTier = (tier || "").trim().toLowerCase();
  if (normalizedTier === "free") return "productTier.freeEdition";
  if (normalizedTier === "shared_webmail") return "productTier.sharedWebmail";
  if (normalizedTier === "zimbra_native") return "productTier.zimbraNative";
  if (normalizedTier === "google_connect") return "productTier.googleConnect";
  if (normalizedTier === "per_mailbox") return "productTier.zimbraNative";

  const normalizedEdition = (edition || "").trim().toLowerCase();
  if (normalizedEdition === "mail_native_zimbra") return "productTier.zimbraNative";
  if (normalizedEdition === "mail_google") return "productTier.googleConnect";
  return "productTier.sharedWebmail";
}
