class TrendController implements Constants {

    @RequestMapping(path = "/v1/trend/compliance/certificates", method = RequestMethod.POST)
    public ResponseEntity<Object> getCertTrend(@RequestBody(required = true) CompliantTrendRequest request) {

        Map<String, Object> response = new HashMap<>();
        String assetGroup = request.getAg();

        Date input = request.getFrom();

        if (input == null) {
            Calendar cal = Calendar.getInstance();
            cal.setTimeZone(TimeZone.getTimeZone("UTC"));
            cal.add(Calendar.DATE, NEG_THIRTY);
            input = cal.getTime();
        }

        Instant instant = input.toInstant();
        ZonedDateTime zdt = instant.atZone(ZoneId.systemDefault());
        LocalDate fromDate = zdt.toLocalDate();
        LocalDate toDate = LocalDate.now();

        if (Strings.isNullOrEmpty(assetGroup)) {
            return ResponseUtils.buildFailureResponse(new Exception(ASSET_MANDATORY));
        }

        try {
            Map<String, Object> ruleTrendProgressList = trendService.getTrendProgress(assetGroup, null, fromDate,
                    toDate, "certcompliance");
            response.put(RESPONSE, ruleTrendProgressList);
        } catch (ServiceException e) {
            LOGGER.error("Exception in getCertTrend" , e.getMessage());
            return ResponseUtils.buildFailureResponse(e);
        }
        return ResponseUtils.buildSucessResponse(response);
    }

}