package com.its.api.its.service.statistics;

import com.its.api.its.model.dto.statistics.TrafficSpecParam;
import com.its.api.its.model.dto.statistics.TrafficStatDto;
import com.its.api.its.repository.statistics.TrafficSpecStatisticsMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Service
public class TrafficSpecStatisticsService {

    private final TrafficSpecStatisticsMapper mapper;

    public List<TrafficStatDto> findAllLink15M(String fromHh, String toHh, List<String> days, String LINK_ID) {
/*
        Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("LINK_ID", LINK_ID);
*/
        TrafficSpecParam param = new TrafficSpecParam(LINK_ID, fromHh, toHh, days);
        return this.mapper.findAllLink15M(param);
    }
    public List<TrafficStatDto> findAllLinkHH(String fromHh, String toHh, List<String> days, String LINK_ID) {
/*
        Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("LINK_ID", LINK_ID);*/
        TrafficSpecParam param = new TrafficSpecParam(LINK_ID, fromHh, toHh, days);
        return this.mapper.findAllLinkHH(param);
    }

    public List<TrafficStatDto> findAllIfsc15M(String fromHh, String toHh, List<String> days, String IFSC_ID) {
/*
        Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("IFSC_ID", IFSC_ID);*/
        TrafficSpecParam param = new TrafficSpecParam(IFSC_ID, fromHh, toHh, days);
        return this.mapper.findAllIfsc15M(param);
    }
    public List<TrafficStatDto> findAllIfscHH(String fromHh, String toHh, List<String> days, String IFSC_ID) {
        /*Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("IFSC_ID", IFSC_ID);*/
        TrafficSpecParam param = new TrafficSpecParam(IFSC_ID, fromHh, toHh, days);
        return this.mapper.findAllIfscHH(param);
    }

    public List<TrafficStatDto> findAllRoad15M(String fromHh, String toHh, List<String> days, String ROAD_ID) {
        /*Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("ROAD_ID", ROAD_ID);*/
        TrafficSpecParam param = new TrafficSpecParam(ROAD_ID, fromHh, toHh, days);
        return this.mapper.findAllRoad15M(param);
    }
    public List<TrafficStatDto> findAllRoadHH(String fromHh, String toHh, List<String> days, String ROAD_ID) {
        /*Map<String, String> param = new HashMap<>();
        param.put("FROM_HH", fromHh);
        param.put("TO_HH", toHh);
        param.put("DAYS", days);
        param.put("ROAD_ID", ROAD_ID);*/
        TrafficSpecParam param = new TrafficSpecParam(ROAD_ID, fromHh, toHh, days);
        return this.mapper.findAllRoadHH(param);
    }

}
