package com.dbnt.kcscopensearch.kcsc.docView.service;

import com.dbnt.kcscopensearch.kcsc.docView.model.DocContentView;
import com.dbnt.kcscopensearch.kcsc.docView.model.DocIndexView;
import com.dbnt.kcscopensearch.kcsc.docView.model.DocTitleView;
import com.dbnt.kcscopensearch.kcsc.docView.repository.DocContentViewRepository;
import com.dbnt.kcscopensearch.kcsc.docView.repository.DocIndexViewRepository;
import com.dbnt.kcscopensearch.kcsc.docView.repository.DocTitleViewRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor
public class DocViewService {
  private final DocTitleViewRepository titleRepository;
  private final DocIndexViewRepository indexRepository;
  private final DocContentViewRepository contentRepository;

  public Map<String, List<?>> selectAllView(){
    Map<String, List<?>> viewDataMap = new HashMap<>();
    viewDataMap.put("docTitle", titleRepository.findAll());
    viewDataMap.put("docIndex", indexRepository.findAll());
    viewDataMap.put("docContent", contentRepository.findAll());
    return viewDataMap;
  }

  public List<DocTitleView> selectAllDocTitle(){
    return titleRepository.findAll();
  }

  public List<DocIndexView> selectAllDocIndex(){
    return indexRepository.findAll();
  }

  public List<DocContentView> selectAllDocContent(){
    return contentRepository.findAll();
  }
}
