const { getMultiHotelOffers, getOfferPricing } = require('../models/hotelSearchModel');

exports.getHotelOffers = async (req, res) => {
  try {
    const data = await getMultiHotelOffers(req.query);
    res.status(200).json({ success: true, data });
  } catch (error) {
    console.error('Hotel Offers Search Error:', error);
    res.status(error.statusCode || 500).json({ error: error.description || error.message });
  }
};

exports.getHotelOfferDetails = async (req, res) => {
  try {
    const { offerId } = req.params;
    if (!offerId) {
      return res.status(400).json({ error: 'offerId is required' });
    }

    const data = await getOfferPricing(offerId);
    res.status(200).json({ success: true, data });
  } catch (error) {
    console.error('Hotel Offer Details Error:', error);
    res.status(error.statusCode || 500).json({ error: error.description || error.message });
  }
};
