package dev.ksan.etfoglasiserver.repository;

import dev.ksan.etfoglasiserver.model.Subject;
import dev.ksan.etfoglasiserver.model.SubjectAlt;

import java.util.List;
import java.util.UUID;

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

@Repository
public interface SubjectAltRepo extends JpaRepository<SubjectAlt, UUID> {
  @Query("SELECT y.subject FROM SubjectAlt y WHERE :title ILIKE CONCAT('%', y.name, '%')")
  public List<Subject> findSubjectIdWithTitle(@Param("title") String title);
}
