package superm_product_batchRedistributeStoreProduct_request

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

type SupermProductBatchRedistributeStoreProductRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *SupermProductBatchRedistributeStoreProductParam
}

func (c *SupermProductBatchRedistributeStoreProductRequest) GetUrlPath() string {
	return "/superm/product/batchRedistributeStoreProduct"
}

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

}

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

}

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

func (c *SupermProductBatchRedistributeStoreProductRequest) GetParams() *SupermProductBatchRedistributeStoreProductParam {
	return c.Param
}

type TaskParams struct {
	// 店铺主商品ID
	MainProductId int64 `json:"main_product_id"`
	// 需要铺品的门店ID列表
	AddStoreIds []int64 `json:"add_store_ids"`
	// 需要删除子品的门店ID列表
	DelStoreIds []int64 `json:"del_store_ids"`
}
type SupermProductBatchRedistributeStoreProductParam struct {
	// 重新分配任务参数
	TaskParams *TaskParams `json:"task_params"`
}
