package shop_storeSuspend_request

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

type ShopStoreSuspendRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopStoreSuspendParam
}

func (c *ShopStoreSuspendRequest) GetUrlPath() string {
	return "/shop/storeSuspend"
}

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

}

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

}

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

func (c *ShopStoreSuspendRequest) GetParams() *ShopStoreSuspendParam {
	return c.Param
}

type ShopStoreSuspendParam struct {
	// 门店ID
	StoreId int64 `json:"store_id"`
	// 停业原因
	Reason string `json:"reason"`
}
