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

namespace Topsdk.Top.Ability2474;


public class Ability2474
{

    private ITopApiClient topApiClient;

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

    /*
        淘宝客-推广者-查询红包发放个数
        taobao.tbk.dg.vegas.send.report
    */
    public TaobaoTbkDgVegasSendReportResponse TaobaoTbkDgVegasSendReport(TaobaoTbkDgVegasSendReportRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasSendReportResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }

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