package warehouse_getFences_request

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

type WarehouseGetFencesRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseGetFencesParam
}

func (c *WarehouseGetFencesRequest) GetUrlPath() string {
	return "/warehouse/getFences"
}

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

}

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

}

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

func (c *WarehouseGetFencesRequest) GetParams() *WarehouseGetFencesParam {
	return c.Param
}

type WarehouseGetFencesParam struct {
	// 外部围栏id列表，不填则查全部
	OutFenceIdList []string `json:"out_fence_id_list"`
}
