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

import com.its.api.its.model.dto.view.VwFcltSttsDto;
import com.its.api.its.model.entity.view.VwFcltStts;
import com.its.api.its.repository.view.VwFcltSttsRepository;
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 VwFcltSttsService {

    private final VwFcltSttsRepository repo;

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

}
