package com.its.op.service.its.link;

import com.its.op.dto.its.link.TbLinkTrafHsDto;
import com.its.op.entity.its.link.TbLinkTrafHs;
import com.its.op.dao.repository.its.link.TbLinkTrafHsRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Service
public class TbLinkTrafHsService {

    private final TbLinkTrafHsRepository repo;

    public List<TbLinkTrafHsDto> findAllByDateRange(Long LINK_ID, String fromDt, String toDt) {

        List<TbLinkTrafHsDto> result = new ArrayList<>();
        List<TbLinkTrafHs> data = repo.findAllByDateRange(LINK_ID, fromDt, toDt);
        for (TbLinkTrafHs obj : data) {
            result.add(obj.toDto());
        }
        return result;
    }

}
