package instantShopping_createDelivery_request

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

type InstantShoppingCreateDeliveryRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *InstantShoppingCreateDeliveryParam
}

func (c *InstantShoppingCreateDeliveryRequest) GetUrlPath() string {
	return "/instantShopping/createDelivery"
}

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

}

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

}

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

func (c *InstantShoppingCreateDeliveryRequest) GetParams() *InstantShoppingCreateDeliveryParam {
	return c.Param
}

type InstantShoppingCreateDeliveryParam struct {
	// 抖音电商shop order单id
	ShopOrderId string `json:"shop_order_id"`
	// 门店ID
	StoreId int64 `json:"store_id"`
	// 是否需要取件码（0=不需要，1=需要）
	VerifyCodeType int32 `json:"verify_code_type"`
	// 序列码列表，如果包含有多个序列码，请用"_"英文下划线分割（属于数码手机类目的商品订单才需要传序列码。）
	SerialNumberList string `json:"serial_number_list"`
	// 是否需要收件码；true：需要；false：不需要
	NeedReceiverCode bool `json:"need_receiver_code"`
}
