package com.jasamedika.medifirst2000.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

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

import com.jasamedika.medifirst2000.vo.JenisHonorVO;

	import com.jasamedika.medifirst2000.entities.JenisHonor;


import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PerhitunganHonorTimPegawaiService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.entities.PerhitunganHonorTimPegawai;
import com.jasamedika.medifirst2000.vo.PerhitunganHonorTimPegawaiVO;
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
import com.jasamedika.medifirst2000.dao.PerhitunganHonorTimPegawaiDao;

/**
 * Implement class for PerhitunganHonorTimPegawaiService
 * 
 * @author Generator
 * @param <T>
 */
@Service("perhitunganHonorTimPegawaiService")
public class PerhitunganHonorTimPegawaiServiceImpl extends BaseVoServiceImpl implements PerhitunganHonorTimPegawaiService 
{	
	@Autowired
	private BaseConverterImpl<PerhitunganHonorTimPegawaiVO,PerhitunganHonorTimPegawai>perhitunganHonorTimPegawaiConverter;
	@Autowired
private BaseConverterImpl<JenisHonorVO,JenisHonor>jenisHonorConverter;


	@Autowired
	private PerhitunganHonorTimPegawaiDao perhitunganHonorTimPegawaiDao;

	@Override
	public Map<String, Object> savePerhitunganHonorTimPegawai(PerhitunganHonorTimPegawaiVO vo) {
		Map<String, Object> result = new HashMap<String, Object>();
		PerhitunganHonorTimPegawai model = new PerhitunganHonorTimPegawai();
		model = perhitunganHonorTimPegawaiConverter.transferVOToModel(vo,model);
		
		if (CommonUtil.isNotNullOrEmpty(vo.getJenisHonor()))
		{
				model.setJenisHonor(jenisHonorConverter.transferVOToModel(vo.getJenisHonor(), new JenisHonor()));
		}

		PerhitunganHonorTimPegawai resultDomain = perhitunganHonorTimPegawaiDao.save(model);
		if (CommonUtil.isNotNullOrEmpty(resultDomain)) {
			result.put("noRec", resultDomain.getNoRec());
		}

		return result;
	}
}