package com.its.op.service.its.vds;

import com.its.op.dao.repository.its.vds.TbVdsDtctClctPnstRepository;
import com.its.op.dto.its.vds.TbVdsDtctClctPnstDto;
import com.its.op.entity.its.vds.TbVdsDtctClctPnst;
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 TbVdsDtctClctPnstService {

    private final TbVdsDtctClctPnstRepository repo;

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

}
