package com.bytesw.bytebot.repository;

import com.bytesw.bytebot.model.SchedulerTask;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.math.BigInteger;
import java.util.List;
import java.util.Optional;

public interface SchedulerTaskRepository extends CrudRepository<SchedulerTask, BigInteger>, JpaSpecificationExecutor<SchedulerTask> {

    @Query("select b from SchedulerTask b where b.calendarID = :calendarId")
    Optional<List<SchedulerTask>> findByCalendarId(@Param("calendarId") String calendarId);

    @Query("select b from SchedulerTask b where b.processETL = :processId")
    List<SchedulerTask> findByEtlId(@Param("processId") int processId);

}
