package sgc.portal.cw.cw1301.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.cw1301.dto.CW13010001USearch;
import sgc.portal.cw.cw1301.model.CW13010001U;
import sgc.portal.cw.cw1301.persistence.CW13010001UMapper;

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

@Service
public class CW13010001UService {
    private final CW13010001UMapper mapper;

    public CW13010001UService(CW13010001UMapper mapper) {
        this.mapper = mapper;
    }

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

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

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

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