using Hotline.CallCenter.Tels;
using Hotline.CallCenter.Tels.CallTelDomain;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tr.Sdk;
public class CallTelClient : ICallTelClient
{
    private readonly ITrClient _trClient;

    public CallTelClient(ITrClient trClient)
    {
        _trClient = trClient;
    }

    public async Task AddBlacklistAsync(AddBlacklistRequest request, CancellationToken token)
    {
        await _trClient.AddBlacklistAsync(request.Adapt<Blacklist.AddBlacklistRequest>(), token);
    }

    public async Task DelBlacklistAsync(DelBlacklistRequest request, CancellationToken token)
    {
        await _trClient.DelBlacklistAsync(request.Adapt<Blacklist.DelBlacklistRequest>(), token);
    }

    public async Task<int> GetStatusAsync(int status)
    {
        return await Task.FromResult(-1);
    }

    public async Task<List<QueryBlacklistResponse>> QueryBlacklistAsync(QueryBlacklistRequest request, CancellationToken token)
    {
        var result = await _trClient.QueryBlacklistAsync(request.Adapt<Blacklist.QueryBlacklistRequest>(), token);
        return result.Adapt<List<QueryBlacklistResponse>>();
    }

    public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
    {
        var result = await _trClient.QueryTelsAsync(request.Adapt<Tels.QueryTelRequest>(), cancellationToken);
        return result.Adapt<List<QueryTelResponse>>();
    }

    public async Task<QueryTelStateResponse> QueryTelStateAsync(QueryTelStateRequest request, CancellationToken token)
    {
        var result = await _trClient.QueryTelStateAsync(request.Adapt<Tels.QueryTelStateRequest>(), token);
        return result.Adapt<QueryTelStateResponse>();
    }
}
