For every hotel in the HotelDescription table, it will try to match it against entries from the HotelConsolidated table.
New hotel:
If no match could be found, it will add it to the HotelConsolidated table and treat it as a unique hotel. (one-to-one relation; 1 HotelConsoldidated entry and 1 HotelCrossreference entry point to itself).
If it could be match against another hotel, it will determine if the new hotel is a baseprovider or not. If is not, it will only create a cross-reference. If it is a baseprovider, it will swap out the existing HotelConsolidated details with the preferred hoteldetails from the new hotel.
and create the cross-reference.
Updated hotel:
Only if the hotel is a basehotel, we will update the HotelConsolidated table with the details. If the hotel is a cross-reference only, we ignore it.
Inactive hotel:
Hotels come and go, so when a hotel has been marked as inactive by the HotelUpdater service, it needs to be removed from the consolidation tables.
If the hotel to be removed is a basehotel, a new basehotel will be nominated from the cross-reference table and the hotel details from the nominated hotel will be copied over from the HotelDescription table into the HotelConsolidated table.
If the hotel to be removed is a cross-reference only, it will only need to remove the cross-reference from the HotelCrossreference table.