package shop_unsuspendStore_request

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

type ShopUnsuspendStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopUnsuspendStoreParam
}

func (c *ShopUnsuspendStoreRequest) GetUrlPath() string {
	return "/shop/unsuspendStore"
}

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

}

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

}

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

func (c *ShopUnsuspendStoreRequest) GetParams() *ShopUnsuspendStoreParam {
	return c.Param
}

type ShopUnsuspendStoreParam struct {
	// 门店ID
	StoreId int64 `json:"store_id"`
	// 恢复营业原因
	Reason string `json:"reason"`
}
