package superm_orderDispatcher_request

import (
	"encoding/json"
	superm_getDispatcherInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response"
	doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)

type SupermOrderDispatcherRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *SupermOrderDispatcherParam
}

func (c *SupermOrderDispatcherRequest) GetUrlPath() string {
	return "/superm/shopOrderDispatcher"
}

func New() *SupermOrderDispatcherRequest {
	request := &SupermOrderDispatcherRequest{
		Param: &SupermOrderDispatcherParam{},
	}
	request.SetConfig(doudian_sdk.GlobalConfig)
	request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
	return request

}

func (c *SupermOrderDispatcherRequest) Execute(accessToken *doudian_sdk.AccessToken) (*superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse, error) {
	responseJson, err := c.GetClient().Request(c, accessToken)
	if err != nil {
		return nil, err
	}
	response := &superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse{}
	_ = json.Unmarshal([]byte(responseJson), response)
	return response, nil

}

func (c *SupermOrderDispatcherRequest) GetParamObject() interface{} {
	return c.Param
}

func (c *SupermOrderDispatcherRequest) GetParams() *SupermOrderDispatcherParam {
	return c.Param
}

type SupermOrderDispatcherParam struct {
	StoreID        int64  `json:"store_id"`
	ShopOrderID    string `json:"shop_order_id"`
	DispatcherType int32  `json:"dispatcher_type"`
}
