package org.egl_cepgl.pm.repository;

import org.egl_cepgl.pm.model.Applicant;
import org.egl_cepgl.pm.model.Country;
import org.egl_cepgl.pm.model.CustomModel;
import org.egl_cepgl.pm.model.Procurement;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface CountryRepository extends JpaRepository<Country, Long>
{
    List<Country> findCountriesByOrderByNamepAsc();

    @Query(value = "select t.id, t.namep from egl_pm_db.country t",nativeQuery = true)
    List<Map<String, Object>> findAllIdsAndNames();

    List<Country> findAllByOrderByNamepAsc();

    Page<Country> findAllByNamepContaining(String search, Pageable pageable);
}
