package sgc.portal.cw.cw1303.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.base.websquare.GridRowStatus;
import sgc.portal.cw.cw1303.dto.CW13030001USearch;
import sgc.portal.cw.cw1303.model.CW13030001U;
import sgc.portal.cw.cw1303.persistence.CW13030001UMapper;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CW13030001UService {
    private final CW13030001UMapper mapper;

    public CW13030001UService(CW13030001UMapper mapper) {
        this.mapper = mapper;
    }

    public List<EasyHashMap<String, Object>> getList(CW13030001USearch search) {
        return mapper.getList(search);
    }

    public List<EasyHashMap<String, Object>> getContent(CW13030001USearch search) {
        return mapper.getContent(search);
    }

    public List<EasyHashMap<String, Object>> checkResiNo(CW13030001USearch search) {
        return mapper.checkResiNo(search);
    }

    @Transactional
    public Map<String, String> agree(List<CW13030001U> CW13030001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
    	for (CW13030001U cW13030001U : CW13030001U) {
    		agree(cW13030001U);
        }
    	
    	return result;
    }
    
    private void agree(CW13030001U cW13030001U) {
        mapper.agree(cW13030001U);
    }
}
