package de.thpeetz.kontor.media.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import de.thpeetz.kontor.media.data.MediaActor;

import java.util.List;

public interface MediaActorRepository extends JpaRepository<MediaActor, String> {
    @Query("select m from MediaActor m " +
            "where lower(m.name) like lower(concat('%', :searchTerm, '%')) ")
    List<MediaActor> search(@Param("searchTerm") String searchTerm);

    List<MediaActor> findByNameIgnoreCase(String name);

    MediaActor findByName(String name);
}
