using Hotline.KnowledgeBase;
using Hotline.KnowledgeBase.Notifies;
using MediatR;

namespace Hotline.Application.Knowledge
{
    public class GetKnowledgeInfoNotifyHandler : INotificationHandler<GetKnowledgeInfoNotify>
    {
        private readonly IKnowledgeDomainService _knowledgeDomainService;

        public GetKnowledgeInfoNotifyHandler(IKnowledgeDomainService knowledgeDomainService)
        {
            _knowledgeDomainService = knowledgeDomainService;
        }

        /// <summary>
        /// 浏览记录写入处理
        /// </summary>
        /// <param name="notification"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task Handle(GetKnowledgeInfoNotify notification, CancellationToken cancellationToken)
        {
            await _knowledgeDomainService.KnowledgePvIncreaseAsync(notification.Knowledge, cancellationToken);
        }
    }
}
