using Hotline.Api.Controllers;
using Hotline.Identity.Accounts;
using Hotline.Identity.Roles;
using Hotline.Push.FWMessage;
using Hotline.Settings;
using Hotline.Share.Dtos.Push;
using Hotline.Share.Enums.Push;
using Hotline.ThirdAccountDomainServices;
using Hotline.ThirdAccountDomainServices.Interfaces;
using Hotline.Users;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Domain.Cache;
using XF.Domain.Repository;

namespace Hotline.Tests.Domain;

public class PushDomainServiceTest : TestBase
{
    private readonly IPushDomainService _pushDomainService;

    public PushDomainServiceTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, ITypedCache<SystemSetting> cacheSettingData, ThirdAccounSupplierFactory thirdAccountDomainFactory, IServiceProvider serviceProvider, IPushDomainService pushDomainService) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository, cacheSettingData, thirdAccountDomainFactory, serviceProvider)
    {
        _pushDomainService = pushDomainService;
    }

    [Fact]
    public async Task PushMsgUpdateState_Test()
    {
        var inDto = new PushReceiveMessageDto
        {
            Type = "2",
            Status = EPushStatus.Success,
            SmsReplyContent = "5",
            ExternalId = "08dd767e-2866-4f8c-8a27-90f44f8ec44d",
            IsSmsReply = true,
            SmsReplyTime = "2025-04-16 17:20:50".ObjToDate()
        };
        await _pushDomainService.PushMsgUpdateStateAsync(inDto, CancellationToken.None);
        Thread.Sleep(60 * 1000);
    }
}
