package shop_getStoreFreight_request

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

type ShopGetStoreFreightRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopGetStoreFreightParam
}

func (c *ShopGetStoreFreightRequest) GetUrlPath() string {
	return "/shop/getStoreFreight"
}

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

}

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

}

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

func (c *ShopGetStoreFreightRequest) GetParams() *ShopGetStoreFreightParam {
	return c.Param
}

type ShopGetStoreFreightParam struct {
	// 门店ID
	StoreId int64 `json:"store_id"`
}
