package cz.muni.fi.pa165.soccermanager.repository;

import cz.muni.fi.pa165.soccermanager.entity.Player;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface PlayerRepository extends JpaRepository<Player, Long> {

  @Query("SELECT p FROM Player p WHERE p.team.id = :team")
  List<Player> findByTeam(Long team);

  @Query("SELECT p FROM Player p WHERE p.team is null")
  List<Player> findFreeAgents();
}
