package shop_bindStoreFreight_request

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

type ShopBindStoreFreightRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopBindStoreFreightParam
}

func (c *ShopBindStoreFreightRequest) GetUrlPath() string {
	return "/shop/bindStoreFreight"
}

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

}

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

}

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

func (c *ShopBindStoreFreightRequest) GetParams() *ShopBindStoreFreightParam {
	return c.Param
}

type ShopBindStoreFreightParam struct {
	// 门店IDe
	StoreId int64 `json:"store_id"`
	// 运费模版ID
	FreightId int64 `json:"freight_id"`
}
