package cmm.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import cmm.service.CmmActivityHstVO;
import cmm.service.CmmCmsService;
import cmm.util.DataMap;
import egovframework.com.cmm.service.impl.CmmUseDAO;
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
import egovframework.rte.fdl.cmmn.exception.EgovBizException;
import egovframework.rte.fdl.property.EgovPropertyService;


/**  
 * CMS 콘텐츠관리에 대한 서비스 클래스를 구현한다
 * @Class Name : CmmCmsServiceImpl.java
 * @author ecplaza 
 * @since 2018-05-11
 * @version 1.0
 */
@Service("cmmCmsService")
public class CmmCmsServiceImpl extends EgovAbstractServiceImpl implements CmmCmsService {

	/** LOGGER */
	@SuppressWarnings("unused")
	private static final Logger LOGGER = LoggerFactory.getLogger(CmmCmsServiceImpl.class);
	
	/** EgovPropertyService */
    @Resource(name = "propertiesService")
    protected EgovPropertyService propertiesService;
	
	/** cmmCmsDAO */
    @Resource(name="cmmCmsDAO")
    private CmmCmsDAO cmmCmsDAO;
    
    /** cmmUseDAO */
    @Resource(name="cmmUseDAO")
    private CmmUseDAO cmmUseDAO;

    public List<CmmActivityHstVO> selectCmmScrapList(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{
    	return (List<CmmActivityHstVO>)cmmCmsDAO.selectCmmScrapList(cmmActivityHstVO);
    }
    public List<CmmActivityHstVO> selectCmmActivityHstOpList(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{
    	return (List<CmmActivityHstVO>)cmmCmsDAO.selectCmmActivityHstOpList(cmmActivityHstVO);
    }
    public int selectCmmScrapListTotCnt(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{	
 		return (Integer)cmmCmsDAO.selectCmmScrapListTotCnt(cmmActivityHstVO);
    }
    public int  selectCmmActivityHstOpListTotCnt(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{	
 		return (Integer)cmmCmsDAO.selectCmmActivityHstOpListTotCnt(cmmActivityHstVO);
    }
    public List<String> selectCmmCmsKeywordsList(List<CmmActivityHstVO> result) throws EgovBizException{
		List<Integer> contentId = new ArrayList<Integer>();
		for(int i=0; i< result.size(); i++){
			contentId.add(result.get(i).getId());
			}
		return cmmCmsDAO.selectCmmCmsKeywordsList(contentId);
    }
	public List<DataMap> selectCmmCmsTagsList(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{
		return cmmCmsDAO.selectCmmCmsTagsList(cmmActivityHstVO);
	}
	public List<CmmActivityHstVO> selectCmmCmsPopularList(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{
		return cmmCmsDAO.selectCmmCmsPopularList(cmmActivityHstVO);
	}
	
	public void deleteAllCmmScrapInfo(CmmActivityHstVO cmmActivityHstVO) throws EgovBizException{
		cmmCmsDAO.deleteAllCmmScrapInfo(cmmActivityHstVO);
	}
}
