"use client"

import { usePathname } from "next/navigation"

import { useTrackHardNavigation } from "./useTrackHardNavigation"
import { useTrackSoftNavigation } from "./useTrackSoftNavigation"

import type {
  TrackingSDKAncillaries,
  TrackingSDKHotelInfo,
  TrackingSDKPageData,
  TrackingSDKPaymentInfo,
} from "./types"

export function TrackingSDK({
  pageData,
  hotelInfo,
  paymentInfo,
  ancillaries,
}: {
  pageData: TrackingSDKPageData
  hotelInfo?: TrackingSDKHotelInfo
  paymentInfo?: TrackingSDKPaymentInfo
  ancillaries?: TrackingSDKAncillaries
}) {
  const pathName = usePathname()

  useTrackHardNavigation({
    pageData,
    hotelInfo,
    paymentInfo,
    ancillaries,
    pathName,
  })

  useTrackSoftNavigation({
    pageData,
    hotelInfo,
    paymentInfo,
    ancillaries,
    pathName,
  })

  return null
}
