const hotelRulesService = require("../services/hotelRulesService");

exports.getHotelRules = async (req, res) => {
  console.log("==================================================");
  console.log("CONTROLLER: HotelRulesReq - START");

  try {
    console.log("➡️ Request Body:");
    console.log(JSON.stringify(req.body, null, 2));

    const result = await hotelRulesService.getHotelRules(req.body);

    console.log("✅ CONTROLLER: HotelRulesReq - SUCCESS");
    console.log("==================================================");

    return res.status(200).json({
      success: true,
      message: "Hotel rules fetched successfully",
      data: result,
    });

  } catch (error) {
    console.error("❌ CONTROLLER ERROR: HotelRulesReq");
    console.error(error.message);
    console.log("==================================================");

    return res.status(500).json({
      success: false,
      message: "Hotel rules request failed",
      error: error.message,
    });
  }
};