package com.jasamedika.medifirst2000.service.impl;

import java.util.HashMap;
import java.util.Map;

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

import com.jasamedika.medifirst2000.dao.BundleSetAlatDao;
import com.jasamedika.medifirst2000.entities.BundleSetAlat;
import com.jasamedika.medifirst2000.service.BundleSetAlatService;
import com.jasamedika.medifirst2000.vo.BundleSetAlatVO;

@Service("BundleSetAlatService")
public class BundleSetAlatServiceImpl implements BundleSetAlatService {
	@Autowired
	private BundleSetAlatDao bundleSetAlatDao;

	@Override
	public Map<String, Object> saveBundleSetAlat(BundleSetAlatVO vo) {
		Map<String, Object> result = new HashMap<>();
		BundleSetAlat bundleSetAlat =new BundleSetAlat();
		bundleSetAlat.setId(vo.getId());
		bundleSetAlat.setNamaExternal(vo.getNamaExternal());
		bundleSetAlat.setReportDisplay(vo.getNamaExternal());
		bundleSetAlat.setStatusEnabled(vo.getStatusEnabled());
		BundleSetAlat bundleSetAlatResult = this.bundleSetAlatDao.save(bundleSetAlat);
		if(bundleSetAlatResult.getId()!=0){
			result.put("id", bundleSetAlatResult.getId());
		}
		return result;
	}

	@Override
	public Map<String, Object> getBundleSetAlat() {
		Map<String, Object> result = new HashMap<>();
		result.put("data", this.bundleSetAlatDao.getBundleSetAlat());
		return result;
	}

}
