using DotNetCore.CAP;
using Hotline.Push.FWMessage;
using Hotline.Share.Dtos.Push;
using XF.Domain.Dependency;

namespace Hotline.Application.Push
{
    public class PushTextMessageHandler : ICapSubscribe, IScopeDependency
    {
        /// <summary>
        /// 
        /// </summary>
        private readonly IPushDomainService _pushDomainService;

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

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messageDto"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        [CapSubscribe(Hotline.Share.Mq.EventNames.UpdateSendSmsState)]
        public async Task UpdateSendSmsState(PushReceiveMessageDto messageDto, CancellationToken cancellation)
        {
            await _pushDomainService.PushMsgUpdateStateAsync(messageDto, cancellation);
        }
    }
}
