package com.bytesw.bytebot.etl.dao;

import com.bytesw.bytebot.etl.model.Intent;
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 IntentRepository extends CrudRepository<Intent, Long> {

    Optional<Intent> findByIdentifier(String identifier);

    @Query("SELECT s from Intent s WHERE s.identifier = :intenIdent and  s.agenId = :agenId")
    Optional<Intent> findIntenNameById(@Param("intenIdent") String intenIdent, @Param("agenId") Long agenId);

}
