"use client"

import { trpc } from "@scandic-hotels/trpc/client"

import ProfilingConsentModal from "@/components/MyPages/ProfilingConsent/Modal"
import useLang from "@/hooks/useLang"

/**
 * A read-only version of the Profiling Consent Modal
 * without any of the profiling consent actions.
 **/
export default function ProfilingConsentModalReadOnly() {
  const lang = useLang()
  const { data } = trpc.contentstack.profilingConsent.get.useQuery({ lang })
  const modal = data?.profiling_consent?.modal
  const icon = data?.profiling_consent?.icon

  if (!modal || !icon) return null

  return (
    <ProfilingConsentModal
      memberKey={undefined}
      content={modal}
      iconIdentifier={icon}
      readOnly
    />
  )
}
