using Hotline.Settings;
using Hotline.ThirdAccountDomainServices.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Domain.Dependency;

namespace Hotline.ThirdAccountDomainServices;

public class ThirdAccountDomainService : IThirdAccountDomainService, IScopeDependency
{
    private readonly ISystemLogRepository _systemLogRepository;
    private readonly IThirdAccountRepository _thirdAccountRepository;

    public ThirdAccountDomainService(ISystemLogRepository systemLogRepository, IThirdAccountRepository thirdAccountRepository)
    {
        _systemLogRepository = systemLogRepository;
        _thirdAccountRepository = thirdAccountRepository;
    }

    public async Task UpdateExternalIdAsync(string id,string oldExternalId, string externalId, CancellationToken token)
    {
        _systemLogRepository.Add("更新thirdAccount.ExternalId", id, $"原{oldExternalId}, 更新 {externalId}", "GetLoginOutDataAsync", 1);
        await _thirdAccountRepository.UpdateExternalIdAsync(id, externalId, token);
    }
}
