package eu.dnetlib.repo.manager.controllers;

import eu.dnetlib.repo.manager.service.StatsServiceImpl;
import io.swagger.annotations.Api;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "/stats")
@Api(description = "Stats API",  tags = {"statistics"})
public class StatsController {

    @Autowired
    StatsServiceImpl statsService;

    @RequestMapping(value = "/getStatistics" , method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public Map getStatistics() throws JSONException {
       return statsService.getStatistics();
    }
}
