using System;
using CncService.Interface;
using CncModels.Dto;
using CncModels.Dto.Log;
using CncModels.Constants;
using CncRepository.Interface;

namespace CncService.Impl
{
    /// <summary>
    /// 系统日志实现
    /// </summary>
    public class SystemLogService : ISystemLogService
    {
        private readonly ISystemLogRepository _systemLogRepository;

        public SystemLogService(ISystemLogRepository systemLogRepository)
        {
            _systemLogRepository = systemLogRepository ?? throw new ArgumentNullException(nameof(systemLogRepository));
        }

        /// <inheritdoc/>
        public PagedResult<SystemLogListItem> GetList(SystemLogQuery query)
        {
            if (query == null) throw new BusinessException(ErrorCode.BadRequest, "查询参数不能为空");
            return _systemLogRepository.GetList(query);
        }
    }
}
