package br.gov.sigefp.rh.repository;

import br.gov.sigefp.rh.domain.PayrollRun;
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 PayrollRunRepository extends JpaRepository<PayrollRun, UUID> {
    
    List<PayrollRun> findByPeriodId(UUID periodId);
    
    @Query("SELECT pr FROM PayrollRun pr WHERE pr.period.id = :periodId AND pr.ministry = :ministryId")
    List<PayrollRun> findByPeriodIdAndMinistry(@Param("periodId") UUID periodId, @Param("ministryId") UUID ministryId);
}

