/**
 * Home content controller (public)
 */

const homeService = require('../services/homeService');
const { sendSuccess } = require('../utils/response');

/**
 * Get active banners
 */
exports.getBanners = async (req, res, next) => {
  try {
    const banners = await homeService.getActiveBanners();
    return sendSuccess(res, banners, 'Banners retrieved successfully');
  } catch (error) {
    next(error);
  }
};

/**
 * Get active hot services
 */
exports.getHotServices = async (req, res, next) => {
  try {
    const lang = req.headers['accept-language'] || 'zh';
    const services = await homeService.getActiveHotServices(lang);
    return sendSuccess(res, services, 'Hot services retrieved successfully');
  } catch (error) {
    next(error);
  }
};
