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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.GolonganService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.entities.Golongan;
import com.jasamedika.medifirst2000.vo.GolonganVO;
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
import com.jasamedika.medifirst2000.dao.GolonganDao;
import com.jasamedika.medifirst2000.dao.GolonganPegawaiDao;

/**
 * Implement class for GolonganService
 * 
 * @author Generator
 * @param <T>
 */
@Service("golonganService")
public class GolonganServiceImpl extends BaseVoServiceImpl implements GolonganService {
	@Autowired
	private BaseConverterImpl<GolonganVO, Golongan> golonganConverter;

	@Autowired
	private GolonganDao golonganDao;

	@Autowired
	private GolonganPegawaiDao golonganPegawaiDao;

	@Override
	public Map<String, Object> saveGolongan(GolonganVO vo) {
		Map<String, Object> result = new HashMap<String, Object>();
		Golongan model = new Golongan();
		model = golonganConverter.transferVOToModel(vo, model);

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

		return result;
	}

	@Override
	public List<Map<String, Object>> getKedudukanByStatusEnabled() {
		List<Map<String, Object>> result = golonganPegawaiDao.getAllByStatusEnabled();
		return result;
	}
}