package br.gov.sigefp.treasury.repository;

import br.gov.sigefp.treasury.domain.TreasuryPayment;
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;

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

@Repository
public interface TreasuryPaymentRepository extends JpaRepository<TreasuryPayment, UUID> {
    
    List<TreasuryPayment> findByPaymentOrderId(UUID paymentOrderId);
    
    List<TreasuryPayment> findByStatus(String status);
    
    @Query("SELECT tp FROM TreasuryPayment tp WHERE tp.paymentOrder.id = :paymentOrderId AND tp.status = :status")
    List<TreasuryPayment> findByPaymentOrderIdAndStatus(@Param("paymentOrderId") UUID paymentOrderId, @Param("status") String status);
}

