const adminSettingsService = require("../../services/admin/adminSettingsService");
const ApiResponse = require("../../utils/apiResponse");
const { asyncHandler } = require("../../middleware/errorHandler");

exports.getSettings = asyncHandler(async (req, res) => {
  const data = await adminSettingsService.getSettings();
  ApiResponse.success(res, data);
});

exports.setSetting = asyncHandler(async (req, res) => {
  const { key } = req.params;
  const data = await adminSettingsService.setSetting(key, req.body, req.admin?.id);
  ApiResponse.success(res, data, "Setting updated");
});
