import HandGiftIcon from "@scandic-hotels/design-system/Icons/HandGiftIcon"
import MagicWandIcon from "@scandic-hotels/design-system/Icons/MagicWandIcon"
import SpaIcon from "@scandic-hotels/design-system/Icons/Spa"
import VoucherIcon from "@scandic-hotels/design-system/Icons/VoucherIcon"

import type { User } from "@scandic-hotels/trpc/types/user"

interface GetMainIconByCSIdentifierProps {
  identifier: string
  className?: string
}

// Main (modal/banner) icon mapping — default to Spa icon
export function GetMainIconByCSIdentifier({
  identifier,
  className,
}: GetMainIconByCSIdentifierProps) {
  switch (identifier) {
    case "SpaIcon":
    default:
      return <SpaIcon width={140} height={128} className={className} />
  }
}

export function GetBenefitIconByCSIdentifier(
  identifier: string
): React.ComponentType<{
  width?: number
  height?: number
  className?: string
}> {
  switch (identifier) {
    case "VoucherIcon":
      return VoucherIcon
    case "MagicWandIcon":
      return MagicWandIcon
    case "HandGiftIcon":
    default:
      return HandGiftIcon
  }
}

/**
 * If profilingConsent is undefined, it means that the user has not yet made an active decision to accept or decline.
 * Returns true if the user has taken an action, otherwise false.
 */
export function userHasConsent(consent: User["profilingConsent"]) {
  return typeof consent === "boolean"
}
