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

namespace Topsdk.Top.Ability1826;


public class Ability1826
{

    private ITopApiClient topApiClient;

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

    /*
        淘宝客-推广者-淘礼金创建测试营销ID
        taobao.tbk.dg.vegas.tlj.temporary.create
    */
    public TaobaoTbkDgVegasTljTemporaryCreateResponse TaobaoTbkDgVegasTljTemporaryCreate(TaobaoTbkDgVegasTljTemporaryCreateRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasTljTemporaryCreateResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }
    /*
        淘宝客-推广者-淘礼金暂停发放
        taobao.tbk.dg.vegas.tlj.stop
    */
    public TaobaoTbkDgVegasTljStopResponse TaobaoTbkDgVegasTljStop(TaobaoTbkDgVegasTljStopRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasTljStopResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }
    /*
        淘宝客-推广者-淘礼金创建
        taobao.tbk.dg.vegas.tlj.create
    */
    public TaobaoTbkDgVegasTljCreateResponse TaobaoTbkDgVegasTljCreate(TaobaoTbkDgVegasTljCreateRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasTljCreateResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }
    /*
        淘宝客-推广者-淘礼金效果数据
        taobao.tbk.dg.vegas.tlj.report
    */
    public TaobaoTbkDgVegasTljReportResponse TaobaoTbkDgVegasTljReport(TaobaoTbkDgVegasTljReportRequest request)
    {
        var jsonResult = topApiClient.Execute(request.GetApiCode(),request.ToRequestParam(),request.ToFileParam());
        if (string.IsNullOrEmpty(jsonResult))
        {
            throw new Exception("error");
        }
        var resultObj = TopUtils.parseResultJson<TaobaoTbkDgVegasTljReportResponse>(jsonResult);
        if(string.IsNullOrEmpty(resultObj.Body))
        {
            resultObj.Body = jsonResult;
        }
        return resultObj;
    }

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