using Hotline.Push.FWMessage;
using Hotline.Push.Notifies;
using MediatR;

namespace Hotline.Application.Push
{
    /// <summary>
    /// 内部发送短信
    /// </summary>
    public class PushMessageNotifyHandler : INotificationHandler<PushMessageNotify>
    {
        /// <summary>
        /// 
        /// </summary>
        private readonly IPushDomainService _pushDomainService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pushDomainService"></param>
        public PushMessageNotifyHandler(IPushDomainService pushDomainService)
        {
            _pushDomainService = pushDomainService;
        }

        /// <summary>
        /// 内部发送短信
        /// </summary>
        /// <param name="notification"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task Handle(PushMessageNotify notification, CancellationToken cancellationToken)
        {
            var data = notification.NotifyDto;
            await _pushDomainService.PushMsgAsync(data, cancellationToken);

        }
    }
}
