package warehouse_unbindStore_request

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

type WarehouseUnbindStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *WarehouseUnbindStoreParam
}

func (c *WarehouseUnbindStoreRequest) GetUrlPath() string {
	return "/warehouse/unbindStore"
}

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

}

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

}

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

func (c *WarehouseUnbindStoreRequest) GetParams() *WarehouseUnbindStoreParam {
	return c.Param
}

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