using System.Text.Json.Serialization;
using System.Collections.Generic;
using Topsdk.Util;

namespace Topsdk.Top.Ability865.Request;

public class TaobaoOpenAccountTokenApplyRequest : AbstractTopApiRequest
{

    /*
        isv自己账号的唯一id
            */
    private string? isvAccountId;


    /*
        ISV APP的登录态时长单位是秒
            */
    private long? loginStateExpireIn;


    /*
        open account id
            */
    private long? openAccountId;


    /*
        时间戳单位是毫秒
            */
    private long? tokenTimestamp;


    /*
        用于防重放的唯一id
            */
    private string? uuid;


    /*
        用于透传一些业务附加参数
            */
    private IDictionary<string,object>? ext;


    [JsonPropertyName("isv_account_id")]
    public string? IsvAccountId
    {
        get => isvAccountId;
        set => this.isvAccountId = value;
    }

    [JsonPropertyName("login_state_expire_in")]
    public long? LoginStateExpireIn
    {
        get => loginStateExpireIn;
        set => this.loginStateExpireIn = value;
    }

    [JsonPropertyName("open_account_id")]
    public long? OpenAccountId
    {
        get => openAccountId;
        set => this.openAccountId = value;
    }

    [JsonPropertyName("token_timestamp")]
    public long? TokenTimestamp
    {
        get => tokenTimestamp;
        set => this.tokenTimestamp = value;
    }

    [JsonPropertyName("uuid")]
    public string? Uuid
    {
        get => uuid;
        set => this.uuid = value;
    }

    [JsonPropertyName("ext")]
    public IDictionary<string,object>? Ext
    {
        get => ext;
        set => this.ext = value;
    }



    public override IDictionary<string, string> ToRequestParam()
    {
        IDictionary<string, string> requestParam = new Dictionary<string, string>();
        if(this.isvAccountId != null)
        {
            requestParam.Add("isv_account_id",TopUtils.ConvertBasicType(this.isvAccountId));
        }
        if(this.loginStateExpireIn != null)
        {
            requestParam.Add("login_state_expire_in",TopUtils.ConvertBasicType(this.loginStateExpireIn));
        }
        if(this.openAccountId != null)
        {
            requestParam.Add("open_account_id",TopUtils.ConvertBasicType(this.openAccountId));
        }
        if(this.tokenTimestamp != null)
        {
            requestParam.Add("token_timestamp",TopUtils.ConvertBasicType(this.tokenTimestamp));
        }
        if(this.uuid != null)
        {
            requestParam.Add("uuid",TopUtils.ConvertBasicType(this.uuid));
        }
        if(this.ext != null)
        {
            requestParam.Add("ext",TopUtils.ConvertStruct(this.ext));
        }
        return requestParam;
    }

    public override IDictionary<string, TopFileItem> ToFileParam()
    {
        IDictionary<string, TopFileItem> fileParam = new Dictionary<string, TopFileItem>();
        return fileParam;
    }

    public override string GetApiCode()
    {
        return "taobao.open.account.token.apply";
    }

}

