// flightbilldeskpg/controllers/billdeskController.js

const service = require("../services/flightBilldeskService.js");

exports.createOrder = async (req, res) => {
  try {
    console.log("Flight createOrder req received");
    console.log("req.body:", req.body);

    const data = await service.createOrder(req.body);

    return res.status(200).json({
      success: true,
      message: "Flight order created",
      data,
    });
  } catch (err) {
    console.error("Flight Controller error:", err && err.stack || err);
    return res.status(err.statusCode || 500).json({
      success: false,
      message: err.message || "Internal server error",
      detail: err.detail || null,
    });
  }
};