package instantShopping_notifyDeliveryStatus_request

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

type InstantShoppingNotifyDeliveryStatusRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *InstantShoppingNotifyDeliveryStatusParam
}

func (c *InstantShoppingNotifyDeliveryStatusRequest) GetUrlPath() string {
	return "/instantShopping/notifyDeliveryStatus"
}

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

}

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

}

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

func (c *InstantShoppingNotifyDeliveryStatusRequest) GetParams() *InstantShoppingNotifyDeliveryStatusParam {
	return c.Param
}

type InstantShoppingNotifyDeliveryStatusParam struct {
	// 抖音电商shop order单id
	ShopOrderId string `json:"shop_order_id"`
	// 三方运力服务商
	DistributionCode string `json:"distribution_code"`
	// 三方运单号，自配送时传空字符串
	DistributionDeliveryId string `json:"distribution_delivery_id"`
	// 骑手姓名；骑手已接单/到店/取货/送达状态时必传；
	RiderName *string `json:"rider_name"`
	// 骑手电话；骑手已接单/到店/取货/送达状态时必传；
	RiderPhone *string `json:"rider_phone"`
	// 骑手手机号类型，0是真实号，1是隐私号
	RiderPhoneType int32 `json:"rider_phone_type"`
	// 骑手经度；骑手已接单/到店/取货/送达状态时必传；高德坐标系
	RiderLongitude *string `json:"rider_longitude"`
	// 骑手维度；骑手已接单/到店/取货/送达状态时必传；高德坐标系
	RiderLatitude *string `json:"rider_latitude"`
	// 骑手位置上报时间戳，传入骑手坐标时必填
	ReportTime int64 `json:"report_time"`
	// 状态更新时间戳
	UpdateTime int64 `json:"update_time"`
	// 取消原因
	CancelReason *string `json:"cancel_reason"`
	// 取消编码，参考附件F01，取消状态时必传
	CancelCode *int64 `json:"cancel_code"`
	// 运力状态，枚举：101:待骑手接单102:骑手已接单103:骑手已到店104:骑手已取货200:已送达300:已取消
	Status int64 `json:"status"`
}
