package com.its.op.dao.repository.its.link;

import com.its.op.dto.its.analysis.TbTrafPrcnStatInf;
import com.its.op.entity.its.link.TbTrafPrcnStat;
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;

import java.util.List;

@Repository
public interface TbTrafPrcnStatRepository extends JpaRepository<TbTrafPrcnStat, String>, JpaSpecificationExecutor<TbTrafPrcnStat> {

    @Query("select p.prcnDt as prcnDt, p.linkLigtNum as ligtNum, p.linkDelyNum as delyNum, p.linkCngsNum as cngsNum from TbTrafPrcnStat p where p.prcnDt between :fromDt and :toDt")
    List<TbTrafPrcnStatInf> findAllByDateRangeLINK(@Param("fromDt") String fromDt, @Param("toDt") String toDt);

    @Query("select p.prcnDt as prcnDt, p.ifscLigtNum as ligtNum, p.ifscDelyNum as delyNum, p.ifscCngsNum as cngsNum from TbTrafPrcnStat p where p.prcnDt between :fromDt and :toDt")
    List<TbTrafPrcnStatInf> findAllByDateRangeIFSC(@Param("fromDt") String fromDt, @Param("toDt") String toDt);

    @Query("select p.prcnDt as prcnDt, p.roadLigtNum as ligtNum, p.roadDelyNum as delyNum, p.roadCngsNum as cngsNum from TbTrafPrcnStat p where p.prcnDt between :fromDt and :toDt")
    List<TbTrafPrcnStatInf> findAllByDateRangeROAD(@Param("fromDt") String fromDt, @Param("toDt") String toDt);

    @Query("select p.prcnDt as prcnDt, p.vmsIfscLigtNum as ligtNum, p.vmsIfscDelyNum as delyNum, p.vmsIfscCngsNum as cngsNum from TbTrafPrcnStat p where p.prcnDt between :fromDt and :toDt")
    List<TbTrafPrcnStatInf> findAllByDateRangeVMS(@Param("fromDt") String fromDt, @Param("toDt") String toDt);
}
