import amazonLogo from "@/assets/stores/amazon.svg";
import cdiscountLogo from "@/assets/stores/cdiscount.svg";
import aliexpressLogo from "@/assets/stores/aliexpress.svg";
import backmarketLogo from "@/assets/stores/backmarket.svg";

const LOGOS: Record<string, string> = {
  amazon: amazonLogo,
  cdiscount: cdiscountLogo,
  aliexpress: aliexpressLogo,
  backmarket: backmarketLogo,
};

const normalize = (value: string | undefined): string => {
  if (!value) {
    return "";
  }
  return value
    .toLowerCase()
    .replace(/[^a-z0-9]+/g, "-")
    .replace(/^-+|-+$/g, "");
};

export const getStoreLogo = (storeName: string | undefined): string | null => {
  const key = normalize(storeName);
  return LOGOS[key] || null;
};
