package com.bytesw.bytebot.repository;

import com.bytesw.bytebot.etl.model.Goal;
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.util.Optional;

public interface GoalRepository extends CrudRepository<Goal, Long>, JpaSpecificationExecutor<Goal> {

    @Query("select s from Goal s where s.agenId = :agentId and s.identifier = :identifier")
    Optional<Goal> findByAgentAndIdent(@Param("agentId") Long agentId, @Param("identifier") String identifier);

}
