package com.style24.core.biz.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.style24.core.biz.dao.TscClauseDao;
import com.style24.persistence.domain.Clause;

import lombok.extern.slf4j.Slf4j;

/**
 * 약관 Service
 * 
 * @author gagamel
 * @since 2020. 10. 29
 */
@Service
@Slf4j
public class TscClauseService {

	@Autowired
	private TscClauseDao clauseDao;

	/**
	 * 약관 조회
	 * @param siteCd - 사이트코드
	 * @param clauseType - 약관유형
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 29
	 */
	@Cacheable(value = "common", key = "'clause-'.concat(#clauseType)")
	public String getClause(String siteCd, String clauseType) {
		Clause clause = new Clause();
		clause.setSiteCd(siteCd);
		clause.setClauseType(clauseType);
		return clauseDao.getClause(clause);
	}

}
