export function calculatePricePerNightPriceProduct(
  pricePerNight: number,
  requestedPricePerNight: number | undefined,
  nights: number,
  packagesSumLocal: number,
  packagesSumRequested: number
) {
  const totalPrice = packagesSumLocal
    ? Math.floor(pricePerNight + packagesSumLocal / nights)
    : Math.floor(pricePerNight)

  let totalRequestedPrice = undefined
  if (requestedPricePerNight) {
    if (packagesSumRequested) {
      totalRequestedPrice = Math.floor(
        requestedPricePerNight + packagesSumRequested / nights
      )
    } else {
      totalRequestedPrice = Math.floor(requestedPricePerNight)
    }
  }

  return {
    totalPrice: totalPrice.toString(),
    totalRequestedPrice: totalRequestedPrice?.toString(),
  }
}
