package ability230

import (
	"errors"
	"topsdk"
	"topsdk/ability230/request"
	"topsdk/ability230/response"
	"topsdk/util"
)

type Ability230 struct {
	Client *topsdk.TopClient
}

func NewAbility230(client *topsdk.TopClient) *Ability230 {
	return &Ability230{client}
}

/*
获取订单仓库路由信息
*/
func (ability *Ability230) TaobaoWmsOrderWarehouseRouteGet(req *request.TaobaoWmsOrderWarehouseRouteGetRequest, session string) (*response.TaobaoWmsOrderWarehouseRouteGetResponse, error) {
	if ability.Client == nil {
		return nil, errors.New("Ability230 topClient is nil")
	}
	var jsonStr, err = ability.Client.ExecuteWithSession("taobao.wms.order.warehouse.route.get", req.ToMap(), req.ToFileMap(), session)
	var respStruct = response.TaobaoWmsOrderWarehouseRouteGetResponse{}
	if err != nil {
		// log.Println("taobaoWmsOrderWarehouseRouteGet error", err)
		return &respStruct, err
	}
	err = util.HandleJsonResponse(jsonStr, &respStruct)
	if respStruct.Body == "" || len(respStruct.Body) == 0 {
		respStruct.Body = jsonStr
	}
	return &respStruct, err
}
