package com.dbnt.faisp.faRpt.service;

import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.faRpt.mapper.FaRptMapper;
import com.dbnt.faisp.faRpt.model.FaRptBoard;
import com.dbnt.faisp.faRpt.model.FaRptReadUser;
import com.dbnt.faisp.faRpt.repository.FaRptBoardRepository;
import com.dbnt.faisp.faRpt.repository.FaRptFileRepository;
import com.dbnt.faisp.faRpt.repository.FaRptReadUserRepository;
import com.dbnt.faisp.publicBoard.model.PublicBoard;
import com.dbnt.faisp.publicBoard.model.PublicComment;
import com.dbnt.faisp.publicBoard.model.PublicFile;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.List;
import java.util.UUID;


@Service
@RequiredArgsConstructor
public class FaRptService extends BaseService {
  private final FaRptBoardRepository faRptBoardRepository;
  private final FaRptFileRepository faRptFileRepository;
  private final FaRptReadUserRepository faRptReadUserRepository;
  private final FaRptMapper faRptMapper;


  public List<FaRptBoard> selectFaRptList(FaRptBoard faRptBoard) {
    return faRptMapper.selectFaRptList(faRptBoard);
  }

  public Integer selectFaRptCnt(FaRptBoard faRptBoard) {
    return faRptMapper.selectFaRptCnt(faRptBoard);
  }

  public Integer saveFaRptBoard(FaRptBoard faRptBoard, List<Integer> deleteFileSeq) {
    return 0;
  }

  public FaRptBoard selectFaRptBoard(Integer faRptKey) {
    FaRptBoard faRptBoard = faRptBoardRepository.findById(faRptKey).orElse(null);
    faRptBoard.setFileList(faRptFileRepository.findByFaRptKey(faRptKey));
    faRptBoard.setReadUserList(faRptReadUserRepository.findByFaRptKey(faRptKey));
    return faRptBoard;
  }
}