using Topsdk.Top.Ability382.Request;
using Topsdk.Top.Ability382.Response;
using Topsdk.Util;

namespace Topsdk.Top.Ability382;


public class Ability382
{

    private ITopApiClient topApiClient;

    public Ability382(ITopApiClient topApiClient)
    {
        this.topApiClient = topApiClient;
    }

    /*
        淘宝客-推广者-红包领取状态查询
        taobao.tbk.dg.vegas.send.status
    */
    public TaobaoTbkDgVegasSendStatusResponse TaobaoTbkDgVegasSendStatus(TaobaoTbkDgVegasSendStatusRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasSendStatusResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }

    public ITopApiClient TopApiClient
    {
        get => topApiClient;
        set => topApiClient = value ?? throw new ArgumentNullException(nameof(value));
    }
}
