package warehouse_bindFences_request

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

type WarehouseBindFencesRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseBindFencesParam
}

func (c *WarehouseBindFencesRequest) GetUrlPath() string {
	return "/warehouse/bindFences"
}

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

}

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

}

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

func (c *WarehouseBindFencesRequest) GetParams() *WarehouseBindFencesParam {
	return c.Param
}

type WarehouseBindFencesParam struct {
	// 外部仓id
	OutWarehouseId string `json:"out_warehouse_id"`
	// 外部电子围栏id列表
	OutFenceIds []string `json:"out_fence_ids"`
}
