package warehouse_bindFencesByStore_request

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

type WarehouseBindFencesByStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseBindFencesByStoreParam
}

func (c *WarehouseBindFencesByStoreRequest) GetUrlPath() string {
	return "/warehouse/bindFencesByStore"
}

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

}

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

}

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

func (c *WarehouseBindFencesByStoreRequest) GetParams() *WarehouseBindFencesByStoreParam {
	return c.Param
}

type WarehouseBindFencesByStoreParam struct {
	// 门店id
	StoreId int64 `json:"store_id"`
	// 要添加的外部围栏id列表
	AddOutFenceIds []string `json:"add_out_fence_ids"`
}
