package com.its.op.service.its.vms;

import com.its.op.dao.repository.its.vms.TbVmsFontColrRepository;
import com.its.op.dto.its.vms.TbVmsFontColrDto;
import com.its.op.entity.its.vms.TbVmsFontColr;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

@Slf4j
@RequiredArgsConstructor
@Service
public class TbVmsFontColrService {

    private final TbVmsFontColrRepository repo;

    // 전체 데이터 조회
    @Transactional(readOnly = true)
    public List<TbVmsFontColrDto> findAll() {
        List<TbVmsFontColrDto> result = new ArrayList<>();
        List<TbVmsFontColr> data = this.repo.findAll();
        data.forEach(obj -> {
            if (("Y").equals(obj.getUseYn())) {
                result.add(obj.toDto());
            }
        });
        return result;
    }

}
