package com.bankaudit.service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bankaudit.dao.GeneralTranslatorDao;
import com.bankaudit.model.GeneralTranslator;


@Service("generalTranslatorService")
@Transactional("transactionManager")
public class GeneralTranslatorServiceImpl implements GeneralTranslatorService{
	
	@Autowired
	GeneralTranslatorDao generalTranslatorDao;
	
	@Override
	public List<GeneralTranslator> getGeneralTranslator(Integer legalEntityCode, String modCode, String language,
			String key1, String key2, String code, String maker) {
		return generalTranslatorDao.getGeneralTranslator(legalEntityCode,  modCode,  language, key1,  key2,  code,  maker);
	}
	
	@Override
	public Map<String, String> getGeneralTranslatorKeyValue(Integer legalEntityCode, String modCode, String language,
			String key1, String key2, String code, String maker) {
		List<GeneralTranslator> genParams= generalTranslatorDao.getGeneralTranslator(legalEntityCode, modCode, language, key1,  key2, code, maker);
		Map<String, String> paramKeyValue= genParams.stream().collect(Collectors.toMap(GeneralTranslator::getCode, GeneralTranslator::getNameInLanguage));
		return paramKeyValue;
		
	}

}
