package com.example.system.repository;

import com.example.system.model.RegistrationTable;
import com.example.system.model.UserTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;

public interface RegistrationRepository extends JpaRepository<RegistrationTable, Long> {
    @Query(value = "SELECT u.phone " +
            "FROM registration_table r " +
            "JOIN user_table u ON r.student_id= u.user_id " +
            " WHERE r.competition_id = ?", nativeQuery = true)
    List<String> findByCompetitionId(Long competitionId);
    @Query(value = "SELECT u.email " +
            "FROM registration_table r " +
            "JOIN user_table u ON r.student_id= u.user_id " +
            " WHERE r.competition_id = ?", nativeQuery = true)
    List<String> findompetitionemailId(Long competitionId);
}
