package com.eactive.eai.rms.kakao.rolling;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eactive.eai.rms.common.base.BaseService;
import com.eactive.kakao.rolling.CurrentCommitIdService;
import com.eactive.kakao.rolling.RollingSuffix;
import com.eactive.kakao.rolling.RollingSuffixService;

@Profile("rolling")
@Transactional
@Service
public class RollingSuffixManService extends BaseService {
    
    @Autowired
	private CurrentCommitIdService currentCommitIdService;
    
    @Autowired
	private RollingSuffixService rollingSuffixService;

	public Page<RollingSuffix> selectList(Pageable pageable) {
		return rollingSuffixService.findAll(pageable);
	}

	public String findCommitId() {
		return currentCommitIdService.getCurrentCommitId();
	}
	
	public void insertAndUpdateCommitId(String newCommitId) {
		rollingSuffixService.insertRollingSuffixAndUpdateCurrentCommitId(newCommitId);
	}
    
    public String insertRollingSuffix(String newCommitId) {
    	return rollingSuffixService.insertRollingSuffix(newCommitId);
    }
	
	public void changeCurrentCommitId(String commitId) {
		rollingSuffixService.changeCurrentCommitId(commitId);
	}
}
