const logService = require('../../services/superadmin/LogService.js');
const { ListResponse } = require('../../utils/ListResponse.js');
const { PaginationParam } = require('../../utils/PaginationParams.js');
const { errorResponse } = require('../../utils/Response.js');

exports.getAllLogs = async (req, res) => {
    try {
        const { page, limit, search, sortBy, orderBy } = PaginationParam(req);

        const { logs, total } = await logService.getAllLogsService({
            page, limit, search, sortBy, orderBy
        });

        return ListResponse({ req, res, data: logs, page, limit, total, message: 'Logs data successfully retrieved' });
    } catch (err) {
        return errorResponse(res, err);
    }
};