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.MapRuanganToAkomodasi;

@Repository("mapRuanganToAkomodasiDao")
public interface MapRuanganToAkomodasiDao extends CrudRepository<MapRuanganToAkomodasi, Integer> {

	@Query("select new Map(model.id as id,model.isRawatGabung as isRawatGabung,"
			+ "kamar.id as idKamar,kamar.namaKamar as namaKamar,"
			+ "model.kdProfile as kdProfile,model.kodeExternal as kodeExternal,model.namaExternal as namaExternal,model.noRec as noRec,"
			+ "produk.id as idProduk,produk.namaProduk as namaProduk," + "model.reportDisplay as reportDisplay,"
			+ "ruangan.id as idRuangan,ruangan.namaRuangan as namaRuangan," + "model.statusEnabled as statusEnabled) "
			+ "from MapRuanganToAkomodasi model " + "inner join model.ruangan ruangan "
			+ "left join model.kamar kamar with kamar.statusEnabled is true "
			+ "left join model.produk produk with produk.statusEnabled is true " + "where model.statusEnabled is true "
			+ "and ruangan.statusEnabled is true")
	List<Map<String, Object>> findAllActiveAkomodasi();

}
