
package nlib.user.service.impl;

import java.util.HashMap;

import org.springframework.stereotype.Repository;

import egovframework.com.cmm.service.impl.EgovComAbstractDAO;
import nlib.cmm.crypto.AriaCrypto;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.user.service.NlibLoginVO;

@Repository("loginDAO")
public class LoginDAO extends EgovComAbstractDAO {

	public DataApiResVO login(DataApiReqVO reqVO)  {
		return null;
	}

	public DataApiResVO logout(DataApiReqVO reqVO)  {
		return null;
	}

	public NlibLoginVO selectLoginUserInfo(NlibLoginVO nLoginParamVO)  {
		
		NlibLoginVO nlibLoginVO = selectOne("LoginDAO.selectLoginUserInfo", nLoginParamVO);
				
		// 개인정보 암호화 내용 복호화 처리 
		if(nlibLoginVO != null) {
			nlibLoginVO.decodePrivateInfo();
		}
		return (NlibLoginVO) nlibLoginVO;
	}
	
	public void insertLoginLog(NlibLoginVO userVO) {
		
		// 사용자 최종 접속정보 업데이트 
		update("LoginDAO.updateLoginTimeStamp", userVO);
		
		// 사용자 접속 로그 등록  
		insert("LoginDAO.insertLoginLog", userVO);
	}
	
	public HashMap<String, String> selectCouncilInfoByDnsHost(String councilDnsHost) {
		return (HashMap<String, String>) selectOne("LoginDAO.selectCouncilInfoByDnsHost", councilDnsHost);
	}
	
	public int activateDormantAcc(NlibLoginVO loginVO) {
		return update("LoginDAO.activateDormantAcc", loginVO);
	}
}