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.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.Perlakuan;

@Repository("PerlakuanDao")
public interface PerlakuanDao extends CrudRepository<Perlakuan, Integer>{
	@Query("select new map(p.id as id, p.name as name) from Perlakuan p")
	List<Map<String, Object>> getPerlakuanAll();
	
	@Query("select new map(p.id as id, p.name as name) from Perlakuan p where (p.statusEnabled is null or p.statusEnabled is true) ")
	List<Map<String, Object>> getPerlakuanLimbahKeluar();
	
	@Query("select new map(p.id as id, p.name as name) from Perlakuan p where p.id=:id")
	Map<String, Object> getPerlakuanById(@Param("id")Integer id);

}
