using Hotline.Caching.Interfaces;
using Hotline.CallCenter.Tels;
using Hotline.CallCenter.Tels.CallTelDomain;

namespace Hotline.XingTang;

public class CallTelClient : ICallTelClient
{
    private readonly ISystemDicDataCacheManager _dicCache;

    public CallTelClient(ISystemDicDataCacheManager dicCache)
    {
        _dicCache = dicCache;
    }

    public Task AddBlacklistAsync(AddBlacklistRequest request, CancellationToken token)
    {
        throw new NotImplementedException();
    }

    public Task DelBlacklistAsync(DelBlacklistRequest request, CancellationToken token)
    {
        throw new NotImplementedException();
    }

    public async Task<int> GetStatusAsync(int status)
    {
        var statusMap = _dicCache.XingTangOperationMap;
        var result = statusMap.FirstOrDefault(m => m.DicDataName == status.ToString());
        if (result == null) { return -1; }
        if (int.TryParse(result.DicDataValue, out var value))
        {
            return value;
        }
        return -1;
    }

    public Task<List<QueryBlacklistResponse>> QueryBlacklistAsync(QueryBlacklistRequest request, CancellationToken token)
    {
        throw new NotImplementedException();
    }

    public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
    {
        return new List<QueryTelResponse>();
    }

    public Task<QueryTelStateResponse> QueryTelStateAsync(QueryTelStateRequest request, CancellationToken token)
    {
        throw new NotImplementedException();
    }
}