package warehouse_bindStore_request

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

type WarehouseBindStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseBindStoreParam
}

func (c *WarehouseBindStoreRequest) GetUrlPath() string {
	return "/warehouse/bindStore"
}

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

}

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

}

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

func (c *WarehouseBindStoreRequest) GetParams() *WarehouseBindStoreParam {
	return c.Param
}

type WarehouseBindStoreParam struct {
	// 要添加的门店id列表
	StoreIds []int64 `json:"store_ids"`
	// 外部仓id列表
	OutWarehouseId string `json:"out_warehouse_id"`
}
