package com.jasamedika.medifirst2000.dao;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.StandarPelayananMakanan;

@Repository("StandarPelayananMakananDao")
public interface StandarPelayananMakananDao extends CrudRepository<StandarPelayananMakanan, Integer> {
	@Query("select new map(standarPelayananMakanan.id as id, " +
			" standarPelayananMakanan.berat as berat, standarPelayananMakanan.qty as qty, " +
			" standarPelayananMakanan.energi as energi, standarPelayananMakanan.protein as protein, " +
			" standarPelayananMakanan.lemak as lemak, standarPelayananMakanan.karbonhidrat as karbonhidrat, " +
			" ruangan.id as idRuangan, ruangan.namaExternal as namaRuangan, kelas.id as idKelas, " +
			" kelas.namaExternal as namaKelas, menuMakanan.id as idMenuMakanan, " +
			" menuMakanan.namaExternal as menuMakanan, jenisWaktu.id as idJenisWaktu, " +
			" jenisWaktu.jenisWaktu as jenisWaktu, satuanStandar.id as idSatuan, " +
			" satuanStandar.satuanStandar as satuanStandar) " +
			" from StandarPelayananMakanan standarPelayananMakanan " +
			" left join standarPelayananMakanan.ruangan ruangan " +
			" left join standarPelayananMakanan.kelas kelas " +
			" left join standarPelayananMakanan.menuMakanan menuMakanan " +
			" left join standarPelayananMakanan.jenisWaktu jenisWaktu " +
			" left join standarPelayananMakanan.satuanStandar satuanStandar")
	List<Map<String, Object>> getStandarPelayananMakanan();
	
	@Query("select new map(a.id as id, a.namaRuangan as namaRuangan) " +
			" from Ruangan a where a.statusEnabled in('true')")
	List<Map<String, Object>> getRuangan();

}
