package pwc.taxtech.atms.controller;

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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.CacheDto;
import pwc.taxtech.atms.service.impl.CacheServiceImpl;

import java.util.List;

@RestController
@RequestMapping("/api/v1/cache/")
public class CacheController {

    @Autowired
    private CacheServiceImpl cacheService;

//    @ApiOperation(value = "Get all cache")
    @RequestMapping(value = "getallcache", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody
    List<CacheDto> getAllCache() {
        return cacheService.getAllCache();
    }

//    @ApiOperation(value = "Get cache by key")
    @RequestMapping(value = "getcachebykey", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public CacheDto getCacheByKey(@RequestParam("cacheKey") String cacheKey) {
        return cacheService.getCacheByKey(cacheKey);
    }
}