package com.ozs.rpm.controller;

import com.ozs.rpm.service.system.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SystemController {
    
    @Autowired
    private ReportService reportService;
    
    @GetMapping("/rpm/system/usedKPI/{kpi}")
    int usedKPI(@PathVariable("kpi") String kpiId) {
        int result = 0;
        try {
            result = reportService.usedKPI(kpiId);
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
        if(result > 0) {
            result = 1; 
        }
        return result;
    }
    
}
