package com.jasamedika.medifirst2000.service.impl;

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

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

import com.jasamedika.medifirst2000.converter.PapGenataliaConverter;
import com.jasamedika.medifirst2000.dao.PapGenataliaDao;
import com.jasamedika.medifirst2000.entities.PapGenatalia;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapGenataliaService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.vo.PapGenataliaVO;

/**
 * Implement class for PAPGenataliaService
 * 
 * @author Askur
 */
@Service("PAPGenataliaService")
public class PapGenataliaServiceImpl implements PapGenataliaService {
	@Autowired
	private PapGenataliaDao papGenataliaDao;
	@Autowired
	private PapGenataliaConverter papGenataliaConverter;
	
	@Override
	public Map<String,Object> addGenatalia(PapGenataliaVO vo) throws JpaSystemException, ServiceVOException {
		Map<String,Object> result=new HashMap<String,Object>();
		PapGenatalia model=papGenataliaConverter.transferVOToModel(vo, new PapGenatalia());
		PapGenatalia resultModel=papGenataliaDao.save(model);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papGenatalia", resultModel);
		}
		return result;
	}

	@Override
	public Map<String,Object> updateGenatalia(PapGenataliaVO vo) throws JpaSystemException, ServiceVOException {
		Map<String,Object> result=new HashMap<String,Object>();
		PapGenatalia model=papGenataliaConverter.transferVOToModel(vo, new PapGenatalia());
		PapGenatalia resultModel=papGenataliaDao.save(model);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papGenatalia", resultModel);
		}
		return result;
	}

	@Override
	public Map<String,Object> findByNoCmAndTglInput(String noCm, Date tglInput) {
		Map<String,Object> result=new HashMap<String,Object>();
		PapGenatalia resultModel=papGenataliaDao.findPapGenataliaByNoCmAndTglInput(noCm, tglInput);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papGenatalia", resultModel);
			result.put("dataFound", true);
		}else{
			result.put("dataFound", false);
		}
		return result;
	}

	@Override
	public Object add(Object vo) throws JpaSystemException, ServiceVOException {
		return null;
	}

	@Override
	public Object update(Object vo) throws JpaSystemException, ServiceVOException {
		return null;
	}

	@Override
	public Boolean delete(Object key) throws JpaSystemException {
		return null;
	}

	@Override
	public Object findById(Object key) throws JpaSystemException {
		return null;
	}

	@Override
	public List findAll() throws JpaSystemException {
		return null;
	}

	@Override
	public Map findAllWithPageAndLimitAndSortByAndDirectionParameter(Integer page, Integer limit, String sort,
			String dir) {
		return null;
	}
}
