import { env } from "@/env/server"

import Script from "next/script"

const scriptScrs = {
  // TODO: decide on naming and environments (development vs. test vs. staging etc)
  development: "",
  test: "https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-84c70d82a50c-staging.min.js",
  production:
    "https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-e56085bbe998.min.js",
}

export default function AdobeScript() {
  return (
    <>
      <Script
        strategy="beforeInteractive"
        id="ensure-datalayer"
      >{`window.datalayer = window.datalayer || {}`}</Script>
      <Script src={scriptScrs[env.NODE_ENV]} />
    </>
  )
}
