package warehouse_getWarehouseByStore_request

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

type WarehouseGetWarehouseByStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseGetWarehouseByStoreParam
}

func (c *WarehouseGetWarehouseByStoreRequest) GetUrlPath() string {
	return "/warehouse/getWarehouseByStore"
}

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

}

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

}

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

func (c *WarehouseGetWarehouseByStoreRequest) GetParams() *WarehouseGetWarehouseByStoreParam {
	return c.Param
}

type WarehouseGetWarehouseByStoreParam struct {
	// 门店id列表
	StoreIds []int64 `json:"store_ids"`
}
