package com.kamco.cd.kamcoback.log.service;

import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
import com.kamco.cd.kamcoback.postgres.core.AuditLogCoreService;
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 AuditLogService {
  private final AuditLogCoreService auditLogCoreService;

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

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

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

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

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

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