package space.nstart.pcp.pcp_request_service.repository

import jakarta.transaction.Transactional
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import space.nstart.pcp.pcp_request_service.entity.FlightLineEntity
import java.time.LocalDateTime


interface FlightLineRepository : JpaRepository<FlightLineEntity, Long>{

    @Modifying
    @Transactional
    @Query("DELETE FROM  flight_line WHERE satellite_id =:sat", nativeQuery = true)
    fun deleteBySatId(@Param("sat") sat : Long) : Int


    fun findBySatelliteIdAndTimeBetween(id : Long, tn : LocalDateTime, tk: LocalDateTime) : List<FlightLineEntity>
}