"use client"

import { usePathname } from "next/navigation"

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

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()

  useTrackHardNavigationBasic({
    pageData,
    pathName,
  })

  useTrackSoftNavigationBasic({
    pageData,
    pathName,
  })

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

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

  return null
}
