package com.its.api.its.service.view;

import com.its.api.its.model.dto.view.VwFcltSttsCntDto;
import com.its.api.its.model.entity.view.VwFcltSttsCnt;
import com.its.api.its.repository.view.VwFcltSttsCntRepository;
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 VwFcltSttsCntService {

    private final VwFcltSttsCntRepository repo;

    // 전체 데이터 조회
    @Transactional(readOnly = true)
    public List<VwFcltSttsCntDto> findAll() {
        List<VwFcltSttsCntDto> result = new ArrayList<>();
        List<VwFcltSttsCnt> data = this.repo.findAll();
        for (VwFcltSttsCnt entity : data) {
            result.add(entity.toDto());
        }
        return result;
    }

}
