package com.its.api.its.repository.vms;

import com.its.api.its.model.entity.vms.TbVmsFormObject;
import com.its.api.its.model.entity.vms.TbVmsFormObjectKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface TbVmsFormObjectRepository extends JpaRepository<TbVmsFormObject, TbVmsFormObjectKey>, JpaSpecificationExecutor<TbVmsFormObject> {

    @Query("select count(p.symbLibNmbr) from TbVmsFormObject p where p.symbLibNmbr = :id")
    Integer findUsageCountBySymbolId(@Param("id") Integer id);

    @Query("select count(p.vmsIfscId) from TbVmsFormObject p where p.vmsIfscId = :vmsIfscId")
    Integer findUsageCountByVmsIfscId(@Param("vmsIfscId") Long vmsIfscId);

}
