const configuredReservationHotelId = import.meta.env.VITE_RESERVATION_HOTEL_ID?.trim()

export const reservationHotelId = configuredReservationHotelId || null
export const reservationTimeZone = 'Asia/Bangkok'

let reservationHotelIdProvider: (() => string | null | undefined) | null = null
let reservationTimeZoneProvider: (() => string | null | undefined) | null = null

export function setReservationHotelIdProvider(provider: (() => string | null | undefined) | null): void {
  reservationHotelIdProvider = provider
}

export function setReservationTimeZoneProvider(provider: (() => string | null | undefined) | null): void {
  reservationTimeZoneProvider = provider
}

export function getReservationHotelId(): string | null {
  const providedHotelId = reservationHotelIdProvider?.()?.trim()
  return providedHotelId || reservationHotelId
}

export function getReservationTimeZone(): string {
  const providedTimeZone = reservationTimeZoneProvider?.()?.trim()
  return providedTimeZone || reservationTimeZone
}
