export const SITE_HERO_IMAGES = {
  home: "/assets/distressed-fire-damage.webp",
  homeAbout: "/assets/distressed-broken-windows.webp",
  homeDetail: "/assets/distressed-fire-damage.webp",
  sellFast: "/assets/distressed-broken-windows.webp",
  howItWorks: "/assets/distressed-fire-damage.webp",
  situations: "/assets/distressed-broken-windows.webp",
  locations: "/assets/distressed-fire-damage.webp",
  about: "/assets/distressed-broken-windows.webp",
  contact: "/assets/distressed-fire-damage.webp",
  privacy: "/assets/distressed-broken-windows.webp",
  terms: "/assets/distressed-fire-damage.webp",
  sellAsIs: "/assets/distressed-broken-windows.webp",
  foreclosure: "/assets/distressed-fire-damage.webp",
  inherited: "/assets/distressed-broken-windows.webp",
  divorce: "/assets/distressed-fire-damage.webp",
  insights: "/assets/distressed-broken-windows.webp",
  compare: "/assets/distressed-fire-damage.webp",
  blog: "/assets/distressed-broken-windows.webp",
  cashBenefits: "/assets/distressed-fire-damage.webp",
} as const;

const locationImages = [
  SITE_HERO_IMAGES.locations,
  SITE_HERO_IMAGES.situations,
  SITE_HERO_IMAGES.howItWorks,
  SITE_HERO_IMAGES.about,
  SITE_HERO_IMAGES.sellFast,
  SITE_HERO_IMAGES.privacy,
] as const;

function stableHash(value: string) {
  let hash = 0;
  for (let index = 0; index < value.length; index += 1) {
    hash = (hash * 31 + value.charCodeAt(index)) | 0;
  }
  return Math.abs(hash);
}

export function getLocationHeroImage(stateSlug: string, countySlug = "") {
  const routeKey = `${stateSlug}/${countySlug}`;
  return locationImages[stableHash(routeKey) % locationImages.length];
}

export const contentHeroImages: Record<string, string> = {
  "A Clear Three-Step Home Selling Process": SITE_HERO_IMAGES.howItWorks,
  "Property Situations We Can Help With": SITE_HERO_IMAGES.situations,
  "A Family-Owned Team Focused on Practical Solutions": SITE_HERO_IMAGES.about,
  "Contact Original Home Buyers": SITE_HERO_IMAGES.contact,
  "Privacy Policy": SITE_HERO_IMAGES.privacy,
  "Terms of Use": SITE_HERO_IMAGES.terms,
  "Sell a House As-Is": SITE_HERO_IMAGES.sellAsIs,
  "Foreclosure Help and Home-Sale Options": SITE_HERO_IMAGES.foreclosure,
  "Sell an Inherited Property": SITE_HERO_IMAGES.inherited,
  "Selling a Home During Divorce": SITE_HERO_IMAGES.divorce,
  "Questions to Consider Before You Sell": SITE_HERO_IMAGES.insights,
  "Direct Sale vs. Listing With an Agent": SITE_HERO_IMAGES.compare,
  "Seller Education Blog": SITE_HERO_IMAGES.blog,
  "Cash Sale Benefits and Tradeoffs": SITE_HERO_IMAGES.cashBenefits,
};
