package com.its.op.service.its.ifsc;

import com.its.op.dto.its.ifsc.TbIfscTrafHsDto;
import com.its.op.entity.its.ifsc.TbIfscTrafHs;
import com.its.op.dao.repository.its.ifsc.TbIfscTrafHsRepository;
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 TbIfscTrafHsService {

    private final TbIfscTrafHsRepository repo;

    public List<TbIfscTrafHsDto> findAllByDateRange(Long IFSC_ID, String fromDt, String toDt) {

        List<TbIfscTrafHsDto> result = new ArrayList<>();
        List<TbIfscTrafHs> data = repo.findAllByDateRange(IFSC_ID, fromDt, toDt);
        for (TbIfscTrafHs obj : data) {
            result.add(obj.toDto());
        }
        return result;
        /*Map<String, String> param = new HashMap<>();
        param.put("IFSC_ID", String.valueOf(IFSC_ID));
        param.put("FROM_DT", fromDt);
        param.put("TO_DT", toDt);
        return mapper.findAllByDateRange(param);*/
    }

}
