package de.thpeetz.kontor.tysc.repository;

import java.util.List;

import de.thpeetz.kontor.tysc.data.CardSet;
import de.thpeetz.kontor.tysc.data.Vendor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CardSetRepository extends JpaRepository<CardSet, String> {

    List<CardSet> findByName(String name);

    CardSet findByNameAndVendor(String name, Vendor vendor);

    @Query("select c from CardSet c " +
            "where lower(c.name) like lower(concat('%', :searchTerm, '%')) ")
    List<CardSet> search(@Param("searchTerm") String searchTerm);
}
