package com.tsiwebserver.service.impl;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.tsiwebserver.mapper.StatisticsMapper;
import com.tsiwebserver.service.StatisticsService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;


@Slf4j
@Service
@RequiredArgsConstructor
public class StatisticsServiceImpl implements StatisticsService{

    private final StatisticsMapper statisticsMapper;

    //API
    public List<HashMap<String, Object>> getSearchDailyInvoke(String start,String end) {
		Map<String, Object> list = new HashMap<String, Object>();
		list.put("start", LocalDate.parse(start));
		list.put("end", LocalDate.parse(end));
		return statisticsMapper.getSearchDailyInvoke(list);
	}

	public List<HashMap<String, Object>> getSearchMonthlyInvoke(String start,String end) {
		Map<String, Object> list = new HashMap<String, Object>();
		list.put("start", start);
		list.put("end", end);
//		log.info("list.toString()"+list.toString());
		
		List<HashMap<String, Object>> result = statisticsMapper.getSearchMonthlyInvoke(list);
//		log.info("loggertostring"+result);

		return result;
	}
	
	

	//시스템리소스
	
	public List<HashMap<String, Object>> systemResourceMonthlyData(String start,String end) {
		Map<String, Object> list = new HashMap<String, Object>();
		list.put("start", start);
		list.put("end", end);
//		log.info("list.toString()"+list.toString());
		List<HashMap<String, Object>> result = statisticsMapper.systemResourceMonthlyData(list);
//		log.info("loggertostring : {}", result);
		return result;
	}
	
	 public List<HashMap<String, Object>> systemResourceDailyData(String start,String end) {
			Map<String, Object> list = new HashMap<String, Object>();
			list.put("start", LocalDate.parse(start));
			list.put("end", LocalDate.parse(end));
			return statisticsMapper.systemResourceDailyData(list);
    }
	 
	 
	 
	//신호상태수집정보
		
     public List<HashMap<String, Object>> signalStatusGatherMonthlyData(String start,String end) {
		Map<String, Object> list = new HashMap<String, Object>();
		list.put("start", start);
		list.put("end", end);
//		log.info("list.toString()"+list.toString());
		
		List<HashMap<String, Object>> result=statisticsMapper.signalStatusGatherMonthlyData(list);
//		log.info("loggertostring"+result);
		
		return result;
	}
		
	 public List<HashMap<String, Object>> signalStatusGatherDailyData(String start,String end) {
			Map<String, Object> list = new HashMap<String, Object>();
			list.put("start", LocalDate.parse(start));
			list.put("end", LocalDate.parse(end));
			return statisticsMapper.signalStatusGatherDailyData(list);
    }
	 
	 
	//신호상태수집정보
		
     public List<HashMap<String, Object>> signalStatusSendMonthlyData(String start,String end) {
		Map<String, Object> list = new HashMap<String, Object>();
		list.put("start", start);
		list.put("end", end);
//		log.info("list.toString()"+list.toString());

		List<HashMap<String, Object>> result=statisticsMapper.signalStatusSendMonthlyData(list);
//		log.info("loggertostring"+result);
		return result;
	}
		
	 public List<HashMap<String, Object>> signalStatusSendDailyData(String start,String end) {
			Map<String, Object> list = new HashMap<String, Object>();
			list.put("start", LocalDate.parse(start));
			list.put("end", LocalDate.parse(end));
			return statisticsMapper.signalStatusSendDailyData(list);
    } 

    
}
