class AssetGroupUtil {

    public static List<Map<String, Object>> fetchIssuesInfo(String compapiuri, String ag, List<String> domains ,String token) throws Exception {
        List<Map<String, Object>> issueInfoList = new ArrayList<>();
        Map<String, Object> issuesInfo;
        try {
            for (String domain : domains) {
                String distributionResponse = HttpUtil
                        .get(compapiuri + "/issues/distribution?ag=" + ag + "&domain=" + Util.encodeUrl(domain),token);
                JsonObject distributionJson = new JsonParser().parse(distributionResponse).getAsJsonObject();
                JsonObject distributionObj = distributionJson.get("data").getAsJsonObject().get(DISTRIBUTION)
                        .getAsJsonObject();
                issuesInfo = new HashMap<>();
                issuesInfo.put(DOMAIN, domain);
                issuesInfo.put(TOTAL, distributionObj.get("total_issues").getAsLong());
                JsonObject distributionSeverity = distributionObj.get("distribution_by_severity").getAsJsonObject();
                JsonObject distributionCategory = distributionObj.get("distribution_ruleCategory").getAsJsonObject();

                Set<String> severityKeys = distributionSeverity.keySet();
                for (String severityKey : severityKeys) {
                    issuesInfo.put(severityKey, distributionSeverity.get(severityKey).getAsLong());
                }

                Set<String> categoryKeys = distributionCategory.keySet();
                for (String categoryKey : categoryKeys) {
                    issuesInfo.put(categoryKey, distributionCategory.get(categoryKey).getAsLong());
                }
                issueInfoList.add(issuesInfo);
            }

        } catch (Exception e) {
            LOGGER.error("Error retrieving issues info " , e);
            throw e;
        }
        return issueInfoList;
    }

    private  AssetGroupUtil();

}