package com.siginfo.schedule;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.siginfo.vo.SignalInfoVO;
import com.siginfo.vo.TbIntPhaseVO;
import com.siginfo.vo.TbIntStatusVO;
import com.siginfo.vo.TbIntVO;
import com.siginfo.vo.TbRegionCenterVO;
import com.siginfo.vo.TbSigunguVO;

@Service
public class SigInfoRepository {
	public List<SignalInfoVO> sigInfoList = new ArrayList<SignalInfoVO>();
	public List<Map<String, Object>> centerStatusList = new ArrayList<>();
	public Map<String, TbRegionCenterVO> regionMap = new HashMap<>();
	public Map<String, TbIntVO> intMap = new HashMap<>();
	public Map<String, TbIntStatusVO> intStatusMap = new HashMap<>();
	public Map<String, TbIntPhaseVO> intPhaseMap = new HashMap<>();
	public Map<String, TbSigunguVO> sigunguMap = new HashMap<>();
	
	public Map<String, TbRegionCenterVO> getRegionMap() {
		return regionMap;
	}

	public void setRegionMap(Map<String, TbRegionCenterVO> regionMap) {
		this.regionMap = regionMap;
	}

	public Map<String, TbIntVO> getIntMap() {
		return intMap;
	}

	public void setIntMap(Map<String, TbIntVO> intMap) {
		this.intMap = intMap;
	}

	public Map<String, TbIntStatusVO> getIntStatusMap() {
		return intStatusMap;
	}

	public void setIntStatusMap(Map<String, TbIntStatusVO> intStatusMap) {
		this.intStatusMap = intStatusMap;
	}

	public Map<String, TbIntPhaseVO> getIntPhaseMap() {
		return intPhaseMap;
	}

	public void setIntPhaseMap(Map<String, TbIntPhaseVO> intPhaseMap) {
		this.intPhaseMap = intPhaseMap;
	}

	public Map<String, TbSigunguVO> getSigunguMap() {
		return sigunguMap;
	}

	public void setSigunguMap(Map<String, TbSigunguVO> sigunguMap) {
		this.sigunguMap = sigunguMap;
	}

	public List<SignalInfoVO> getSigInfoList() {
		return sigInfoList;
	}
	
	public void setSigInfoList(List<SignalInfoVO> list) {
		sigInfoList = list;
	}
	
	public void setIntMap(List<TbIntVO> list) {
		Map<String, TbIntVO> resultMap = new HashMap<>();
		if (list.size() > 0) {
			for (TbIntVO vo : list) {
				resultMap.put(vo.getRegionCd() + '_' + vo.getIntNoSe(), vo);
			}
		}
		this.intMap = resultMap;
	}
	
	public void setSigunguMap(List<TbSigunguVO> list) {
		Map<String, TbSigunguVO> map = new HashMap<>();
		if (list != null && list.size() > 0) {
			for (TbSigunguVO vo : list) {
				map.put(String.valueOf(vo.getSigunguCd()) , vo);
			}
		}
		this.sigunguMap = map;
	}
	
	public void setIntPhaseMap(List<TbIntPhaseVO> list) {
		Map<String, TbIntPhaseVO> map = new HashMap<>();
		if (list != null && list.size() > 0) {
			for (TbIntPhaseVO vo : list) {
				map.put(vo.getRegionCd() + "_" + vo.getIntNo() + "_" + vo.getMapNo(), vo);
			}
		}
		this.intPhaseMap = map;
	}
	
	public void setRegionCenterMap(List<TbRegionCenterVO> list) {
		Map<String, TbRegionCenterVO> map = new HashMap<>();
		if (list != null && list.size() > 0) {
			for (TbRegionCenterVO vo : list) {
				map.put(vo.getRegionCd(), vo);
			}
		}
		this.regionMap = map;
	}
	
	public void setIntStatusMap(List<TbIntStatusVO>list) {
		Map<String, TbIntStatusVO> map = new HashMap<>();
		if (list != null && list.size() > 0) {
			for (TbIntStatusVO vo : list) {
				map.put(vo.getRegionCd()  + '_' + vo.getIntNo() + '_' + vo.getMapNo(), vo);
			}
		}
		this.intStatusMap = map;
	}

	public void setCenterStatusList(List<Map<String, Object>> centerStatus) {
		this.centerStatusList = centerStatus;
	}
}
