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

import io.gmss.fiscad.entities.infocad.parametre.SourceDroit;
import io.gmss.fiscad.paylaods.response.ModesAcquisitionSourceSyncResponse;
import io.gmss.fiscad.paylaods.response.SourceDroitsSyncResponse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SourceDroitRepository extends JpaRepository<SourceDroit, Long> {
    @Query(value = "SELECT id, libelle, titre_foncier as titreFoncier, taille_champ_min as tailleChampMin, taille_champ_max as tailleChampMax, type_champ as typeChamp, temoin from source_droit where deleted is false", nativeQuery = true)
    List<SourceDroitsSyncResponse> getSourceDroitSyncResponse();


    @Query(value = "SELECT distinct id,libelle, sdm.sources_droits_id as sourceid  " +
            " from mode_acquisition ma " +
            " inner join sources_de_droits_modes_acquisitions sdm on sdm.modes_acquisitions_id=ma.id  " +
            " where ma.deleted is false ", nativeQuery = true)
    List<ModesAcquisitionSourceSyncResponse> getModeAcquitionSourceSyncResponse();
}

