using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetCore.CAP;
using Hotline.CallCenter.BlackLists;
using Hotline.Share.Mq;

namespace Hotline.Application.Handlers.CallCenter.ListManage
{
    public class BlacklistExpiredHandler : ICapSubscribe
    {
        private readonly IBlacklistDomainService _blacklistDomainService;

        public BlacklistExpiredHandler(IBlacklistDomainService blacklistDomainService)
        {
            _blacklistDomainService = blacklistDomainService;
        }

        [CapSubscribe(EventNames.CallCenterBlackListExpired)]
        public async Task BlacklistExpiredAsync(string phoneNo, CancellationToken cancellationToken)
        {
            await _blacklistDomainService.RemoveAsync(phoneNo, cancellationToken);
        }
    }
}
