package shop_bindStoreSaleLimit_request

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

type ShopBindStoreSaleLimitRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopBindStoreSaleLimitParam
}

func (c *ShopBindStoreSaleLimitRequest) GetUrlPath() string {
	return "/shop/bindStoreSaleLimit"
}

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

}

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

}

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

func (c *ShopBindStoreSaleLimitRequest) GetParams() *ShopBindStoreSaleLimitParam {
	return c.Param
}

type ShopBindStoreSaleLimitParam struct {
	// 门店ID
	StoreId int64 `json:"store_id"`
	// 限售模版ID
	SaleLimitId int64 `json:"sale_limit_id"`
}
