package com.jasamedika.medifirst2000.service.impl;

import java.util.ArrayList;
import java.util.Arrays;
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.dao.KategoryProdukDao;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KategoryProdukService;
import com.jasamedika.medifirst2000.vo.KategoryProdukVO;

@Service("KategoryProdukService")
public class KategoryProdukServiceImpl extends BaseVoServiceImpl implements KategoryProdukService{

	@Autowired
	private KategoryProdukDao kategoryProdukDao;
	
	@Override
	public KategoryProdukVO add(KategoryProdukVO vo) throws JpaSystemException, ServiceVOException {
		return null;
	}

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

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

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

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

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

	@Override
	public Map<String, Object> getKategoryProdukGizi() {
		Map<String,Object> result = new HashMap<String,Object>();
		List<String> idKategoryProdukGizi = Arrays.asList(GetSettingDataFixed("idKategoryProduk").split(","));
		List<Integer> id = new ArrayList<Integer>();
		for(String idKategory : idKategoryProdukGizi){
			id.add(Integer.parseInt(idKategory));
		}
		result.put("data", kategoryProdukDao.getKategoryProdukGizi(id));
		return result;
	}

}
