package io.gmss.fiscad.repositories.infocad.parametre;

import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
import io.gmss.fiscad.paylaods.response.NatureDomaineSyncResponse;
import io.gmss.fiscad.paylaods.response.TypePersonneNatureDomaineSyncResponse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface NatureDomaineRepository extends JpaRepository<NatureDomaine, Long> {
    @Query(value = "select id, libelle, type_domaine_id as typedomaineid from nature_domaine " +
            " where deleted is false ", nativeQuery = true)
    List<NatureDomaineSyncResponse> getNatureDomaineResponse();


    @Query(value = "select tp.id as id, tp.groupe_ouvert as groupeOuvert, tp.libelle as libelle, ndtp.nature_domaine_id as natureDomaineId from type_personne tp " +
            " inner join nature_domaine_type_personne ndtp on ndtp.type_personne_id=tp.id " +
            " where tp.deleted is false  ", nativeQuery = true)
    List<TypePersonneNatureDomaineSyncResponse> getTypePersonneNatureDomaineSyncResponse();

}
