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.PapNeurologiConverter;
import com.jasamedika.medifirst2000.dao.PapNeurologiDao;
import com.jasamedika.medifirst2000.entities.PapNeurologi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapNeurologiService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.vo.PapNeurologiVO;

/**
 * Implement class for PAPNeurologiService
 * 
 * @author Askur
 */
@Service("PAPNeurologiService")
public class PapNeurologiServiceImpl implements PapNeurologiService {
	@Autowired
	private PapNeurologiDao papNeurologiDao;
	@Autowired
	private PapNeurologiConverter papNeurologiConverter;
	
	@Override
	public Map<String,Object> addNeurologi(PapNeurologiVO vo) throws JpaSystemException, ServiceVOException {
		Map<String,Object> result=new HashMap<String,Object>();
		PapNeurologi model=papNeurologiConverter.transferVOToModel(vo, new PapNeurologi());
		PapNeurologi resultModel=papNeurologiDao.save(model);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papNeurologi", resultModel);
		}
		return result;
	}

	@Override
	public Map<String,Object> updateNeurologi(PapNeurologiVO vo) throws JpaSystemException, ServiceVOException {
		Map<String,Object> result=new HashMap<String,Object>();
		PapNeurologi model=papNeurologiConverter.transferVOToModel(vo, new PapNeurologi());
		PapNeurologi resultModel=papNeurologiDao.save(model);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papNeurologi", resultModel);
			result.put("dataFound", true);
		}else{
			result.put("dataFound", false);
		}
		return result;
	}

	@Override
	public Map<String,Object> findByNoCmAndTglInput(String noCm, Date tglInput) {
		Map<String,Object> result=new HashMap<String,Object>();
		PapNeurologi resultModel=papNeurologiDao.findPapNeurologiByNoCmAndTglInput(noCm, tglInput);
		if(CommonUtil.isNotNullOrEmpty(resultModel)){
			result.put("papNeurologi", 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;
	}

}
