package com.kamco.cd.training.postgres.core;

import com.kamco.cd.training.common.service.BaseCoreService;
import com.kamco.cd.training.log.dto.AuditLogDto;
import com.kamco.cd.training.log.dto.AuditLogDto.DownloadReq;
import com.kamco.cd.training.postgres.repository.log.AuditLogRepository;
import java.time.LocalDate;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class AuditLogCoreService
    implements BaseCoreService<AuditLogDto.DailyAuditList, Long, AuditLogDto.searchReq> {

  private final AuditLogRepository auditLogRepository;

  @Override
  public void remove(Long aLong) {}

  @Override
  public AuditLogDto.DailyAuditList getOneById(Long aLong) {
    return null;
  }

  @Override
  public Page<AuditLogDto.DailyAuditList> search(AuditLogDto.searchReq searchReq) {
    return null;
  }

  public Page<AuditLogDto.DailyAuditList> getLogByDaily(
      AuditLogDto.searchReq searchRange, LocalDate startDate, LocalDate endDate) {
    return auditLogRepository.findLogByDaily(searchRange, startDate, endDate);
  }

  public Page<AuditLogDto.MenuAuditList> getLogByMenu(
      AuditLogDto.searchReq searchRange, String searchValue) {
    return auditLogRepository.findLogByMenu(searchRange, searchValue);
  }

  public Page<AuditLogDto.UserAuditList> getLogByAccount(
      AuditLogDto.searchReq searchRange, String searchValue) {
    return auditLogRepository.findLogByAccount(searchRange, searchValue);
  }

  public Page<AuditLogDto.DownloadRes> findLogByAccount(
      AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
    return auditLogRepository.findDownloadLog(searchReq, downloadReq);
  }

  public Page<AuditLogDto.DailyDetail> getLogByDailyResult(
      AuditLogDto.searchReq searchRange, LocalDate logDate) {
    return auditLogRepository.findLogByDailyResult(searchRange, logDate);
  }

  public Page<AuditLogDto.MenuDetail> getLogByMenuResult(
      AuditLogDto.searchReq searchRange, String menuId) {
    return auditLogRepository.findLogByMenuResult(searchRange, menuId);
  }

  public Page<AuditLogDto.UserDetail> getLogByAccountResult(
      AuditLogDto.searchReq searchRange, Long accountId) {
    return auditLogRepository.findLogByAccountResult(searchRange, accountId);
  }
}
