import BathroomCabinetIcon from "@scandic-hotels/design-system/Icons/BathroomCabinetIcon"
import BedHotelIcon from "@scandic-hotels/design-system/Icons/BedHotelIcon"
import BowlingPinsIcon from "@scandic-hotels/design-system/Icons/BowlingPinsIcon"
import BunkBedIcon from "@scandic-hotels/design-system/Icons/BunkBedIcon"
import ConferenceRoomIcon from "@scandic-hotels/design-system/Icons/ConferenceRoomIcon"
import CoolingIcon from "@scandic-hotels/design-system/Icons/CoolingIcon"
import CouchTableIcon from "@scandic-hotels/design-system/Icons/CouchTableIcon"
import DoorIcon from "@scandic-hotels/design-system/Icons/DoorIcon"
import FootStoolIcon from "@scandic-hotels/design-system/Icons/FootStoolIcon"
import HairdresserIcon from "@scandic-hotels/design-system/Icons/HairdresserIcon"
import HairdryerIcon from "@scandic-hotels/design-system/Icons/HairdryerIcon"
import HandSoapIcon from "@scandic-hotels/design-system/Icons/HandSoapIcon"
import IceMachineIcon from "@scandic-hotels/design-system/Icons/IceMachineIcon"
import MassageIcon from "@scandic-hotels/design-system/Icons/MassageIcon"
import {
  MaterialIcon,
  type MaterialIconSetIconProps,
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
import MirrorIcon from "@scandic-hotels/design-system/Icons/MirrorIcon"
import MovingBedsIcon from "@scandic-hotels/design-system/Icons/MovingBedsIcon"
import RecordPlayerIcon from "@scandic-hotels/design-system/Icons/RecordPlayerIcon"
import RoadIcon from "@scandic-hotels/design-system/Icons/RoadIcon"
import RugIcon from "@scandic-hotels/design-system/Icons/RugIcon"
import SafetyBoxIcon from "@scandic-hotels/design-system/Icons/SafetyBoxIcon"
import SlippersIcon from "@scandic-hotels/design-system/Icons/SlippersIcon"
import ToiletIcon from "@scandic-hotels/design-system/Icons/ToiletIcon"
import TowelIcon from "@scandic-hotels/design-system/Icons/TowelIcon"
import UserPoliceIcon from "@scandic-hotels/design-system/Icons/UserPoliceIcon"
import ViewIcon from "@scandic-hotels/design-system/Icons/ViewIcon"
import WardIcon from "@scandic-hotels/design-system/Icons/WardIcon"
import WindowNotAvailableIcon from "@scandic-hotels/design-system/Icons/WindowNotAvailableIcon"
import WoodFloorIcon from "@scandic-hotels/design-system/Icons/WoodFloorIcon"

import type {
  IconProps,
  NucleoIconProps,
} from "@scandic-hotels/design-system/Icons"
import type { MaterialSymbolProps } from "@scandic-hotels/design-system/Icons/MaterialIcon/MaterialSymbol"
import type { JSX } from "react"

interface FacilityIconProps {
  name: string | undefined
}
export function FacilityIcon({
  name,
  ...props
}:
  | (FacilityIconProps & MaterialIconSetIconProps)
  | NucleoIconProps
  | IconProps): JSX.Element {
  if (!name) {
    return <MaterialIcon icon="favorite" {...props} />
  }

  const normalizedName = name.toLowerCase()

  const customIcon = CustomIconMappings.find(
    (icon) => icon.name.toLowerCase() === normalizedName
  )
  if (customIcon) {
    return <customIcon.icon {...props} />
  }

  const materialSymbolIcon = MaterialIconMappings.find(
    (icon) => icon.name.toLowerCase() === normalizedName
  )

  return materialSymbolIcon ? (
    <MaterialIcon icon={materialSymbolIcon.icon} {...props} />
  ) : (
    <MaterialIcon icon="favorite" {...props} />
  )
}

const MaterialIconMappings: {
  icon: MaterialSymbolProps["icon"]
  name: string
}[] = [
  { icon: "air_purifier_gen", name: "aircondition" },
  { icon: "travel", name: "airport" },
  { icon: "balcony", name: "balcony" },
  { icon: "deck", name: "balconyorterrace" },
  { icon: "balcony", name: "frenchbalcony" },
  { icon: "bathtub", name: "bathroomwithbathtub" },
  { icon: "bathtub", name: "bathroomwithshowerandbathtub" },
  { icon: "bed", name: "setoftwopillows" },
  { icon: "chair", name: "armchairbed" },
  { icon: "meeting_room", name: "separatebedroom" },
  { icon: "pedal_bike", name: "bikeforloan" },
  { icon: "bakery_dining", name: "breakfast" },
  { icon: "bakery_dining", name: "servesbreakfastalwaysincluded" },
  { icon: "business_center", name: "meetingconferencefacilities" },
  { icon: "business_center", name: "meetingrooms" },
  { icon: "router", name: "internetwithcableintheroom" },
  { icon: "chair", name: "armchair" },
  { icon: "chair", name: "chair" },
  { icon: "meeting_room", name: "connectingrooms" },
  { icon: "location_city", name: "viewcityview" },
  { icon: "coffee_maker", name: "nespressomachine" },
  { icon: "dining", name: "café" },
  { icon: "coffee", name: "coffee" },
  { icon: "coffee_maker", name: "coffeemachine" },
  { icon: "concierge", name: "lifestyleconcierge" },
  { icon: "mode_fan", name: "aircooling" },
  { icon: "mode_fan", name: "cooler" },
  { icon: "desk", name: "deskandchair" },
  { icon: "desk", name: "desk" },
  { icon: "dining", name: "diningarea" },
  { icon: "table_bar", name: "tablefordining" },
  { icon: "electric_bike", name: "ebikeschargingstation" },
  { icon: "family_restroom", name: "extrafamilyfriendly" },
  { icon: "exercise", name: "gym" },
  { icon: "health_and_beauty", name: "beautysalon" },
  { icon: "bathroom", name: "bathroom2separatebathrooms" },
  { icon: "credit_card_heart", name: "cashfree800pmtill0600am" },
  { icon: "credit_card_heart", name: "cashfreehotel" },
  { icon: "confirmation_number", name: "coffeevoucher" },
  { icon: "water_full", name: "complimentarycoldrefreshments" },
  { icon: "groups", name: "conventioncentre" },
  { icon: "accessible", name: "disabledparking" },
  { icon: "charging_station", name: "dockingstationforipodipad" },
  { icon: "cool_to_dry", name: "dryingcabinet" },
  { icon: "assistant_navigation", name: "easyaccess" },
  { icon: "laundry", name: "garmentsteamer" },
  { icon: "stairs", name: "highfloor" },
  { icon: "hot_tub", name: "jaccuzzi" },
  { icon: "hot_tub", name: "jacuzzi" },
  { icon: "countertops", name: "kitchen" },
  { icon: "countertops", name: "kitchenette" },
  { icon: "checked_bag", name: "latecheckoutuntil1400guaranteed" },
  { icon: "music_cast", name: "livemusicexhibitions" },
  { icon: "liquor", name: "minibarincludedinroomrate" },
  { icon: "local_parking", name: "parkingadditionalcost" },
  { icon: "sauna", name: "privatesauna" },
  { icon: "kitchen", name: "refrigerator" },
  { icon: "airline_seat_recline_normal", name: "seatingarea" },
  { icon: "scene", name: "separatelivingroom" },
  { icon: "chair", name: "sofabed" },
  { icon: "chair", name: "sofas" },
  { icon: "chair", name: "sofa" },
  { icon: "bedroom_parent", name: "spaciousroom" },
  { icon: "local_drink", name: "stillandsparklingwater" },
  { icon: "table_bar", name: "table" },
  { icon: "coffee_maker", name: "tassimocoffeemaker" },
  { icon: "deck", name: "terrace" },
  { icon: "iron", name: "trouserpress" },
  { icon: "tv_guide", name: "tv" },
  { icon: "tv_remote", name: "tvwithcomplimentarymoviechannels" },
  { icon: "tv_remote", name: "tvwithmoviechannels" },
  { icon: "live_tv", name: "tvwithstreamingoption" },
  { icon: "hvac", name: "ventilationinroom" },
  { icon: "landscape", name: "viewfjordview" },
  { icon: "houseboat", name: "viewlakeview" },
  { icon: "panorama", name: "viewpanoramicview" },
  { icon: "sailing", name: "viewseaview" },
  { icon: "ward", name: "wallbed" },
  { icon: "pedal_bike", name: "wallmountedcyclerack" },
  { icon: "dresser", name: "wardrobe" },
  { icon: "spa", name: "wellnessandsaunaentrancefeeadmission16years" },
  { icon: "spa", name: "wellnesspoolsaunaentrancefeeadmission16years" },
  { icon: "curtains", name: "windownook" },
  { icon: "iron", name: "ironandironingboard" },
  { icon: "iron", name: "ironingroom" },
  { icon: "kayaking", name: "kayaksforloan" },
  { icon: "kettle", name: "kettle" },
  { icon: "kettle", name: "kettlewithcoffee" },
  { icon: "sync_saved_locally", name: "laptopsafe" },
  { icon: "computer", name: "laptoptray" },
  { icon: "local_laundry_service", name: "laundryservice" },
  { icon: "local_bar", name: "bar" },
  { icon: "deck", name: "rooftopbar" },
  { icon: "local_bar", name: "skybar" },
  { icon: "microwave", name: "microwave" },
  { icon: "nature", name: "viewparkview" },
  { icon: "nightlife", name: "disconightclub" },
  { icon: "smoke_free", name: "nonsmoking" },
  { icon: "deck", name: "outdoorterrace" },
  { icon: "local_parking", name: "parking" },
  { icon: "local_parking", name: "parkingfreeparking" },
  { icon: "pets", name: "petfriendlyrooms" },
  { icon: "phone", name: "directdialphoneandvoicemail" },
  { icon: "restaurant", name: "restaurant" },
  { icon: "room_service", name: "roomservice" },
  { icon: "sauna", name: "sauna" },
  { icon: "shower", name: "bathroomwithshower" },
  { icon: "shower", name: "rainshower" },
  { icon: "shower", name: "sharedbathroomwithshower" },
  { icon: "radio", name: "musicplayer" },
  { icon: "shopping_bag", name: "shop" },
  { icon: "pool", name: "pool" },
  { icon: "laundry", name: "handwash" },
  { icon: "connected_tv", name: "tvwithchromecast" },
  { icon: "wifi", name: "freewifi" },
  { icon: "curtains_closed", name: "blackoutcurtains" },
  { icon: "liquor", name: "minibar" },
  { icon: "yard", name: "viewatriumview" },
]

const CustomIconMappings = [
  { icon: BathroomCabinetIcon, name: "bathroomwithshowerorbathtub" },
  { icon: MovingBedsIcon, name: "adjustablebeds" },
  { icon: MovingBedsIcon, name: "pulloutbed" },
  { icon: BedHotelIcon, name: "extrabed" },
  { icon: CoolingIcon, name: "coolingcabinet" },
  { icon: FootStoolIcon, name: "footstool" },
  { icon: HairdryerIcon, name: "hairdryer" },
  { icon: HairdresserIcon, name: "hairdresser" },
  { icon: HandSoapIcon, name: "toiletries" },
  { icon: TowelIcon, name: "bathrobes" },
  { icon: HandSoapIcon, name: "bodycareproducts" },
  { icon: HandSoapIcon, name: "bodylotion" },
  { icon: BowlingPinsIcon, name: "bowling" },
  { icon: BunkBedIcon, name: "bunkbed" },
  { icon: BunkBedIcon, name: "bunkbed80x188cm" },
  { icon: IceMachineIcon, name: "icemachine" },
  { icon: IceMachineIcon, name: "icemachinereception" },
  { icon: MassageIcon, name: "massage" },
  { icon: ConferenceRoomIcon, name: "meetingarea" },
  { icon: UserPoliceIcon, name: "overnightsecurity" },
  { icon: UserPoliceIcon, name: "security24hoours" },
  { icon: UserPoliceIcon, name: "servicesecurity24h" },
  { icon: FootStoolIcon, name: "footstool" },
  { icon: WindowNotAvailableIcon, name: "nowindow" },
  { icon: DoorIcon, name: "luggagelockers" },
  { icon: MirrorIcon, name: "cosmeticmirror" },
  { icon: WardIcon, name: "wallbed" },
  { icon: CouchTableIcon, name: "sofawithtable" },
  { icon: SafetyBoxIcon, name: "safetybox" },
  { icon: RecordPlayerIcon, name: "modernvinylplayer" },
  { icon: RugIcon, name: "carpetingwalltowallcarpet" },
  { icon: ToiletIcon, name: "separatetoilet" },
  { icon: WoodFloorIcon, name: "woodenfloor" },
  { icon: ViewIcon, name: "view" },
  { icon: HandSoapIcon, name: "shampoo" },
  { icon: HandSoapIcon, name: "conditioner" },
  { icon: RoadIcon, name: "viewstreetview" },
  { icon: SlippersIcon, name: "slippers" },
  { icon: HandSoapIcon, name: "showergel" },
  { icon: HandSoapIcon, name: "showerproductsscentbygrandcentral" },
]
