package dto

type FlashExpressWebhookSign struct {
	MchId    string `json:"mchId"`
	NonceStr string `json:"nonceStr"`
	Sign     string `json:"sign"`
}

// Status
type NotifyStatusFlashExpressRequest struct {
	MchId    string                              `json:"mchId"`
	NonceStr string                              `json:"nonceStr"`
	Sign     string                              `json:"sign"`
	Data     NotifyStatusFlashExpressRequestData `json:"data"`
}

type NotifyStatusFlashExpressRequestData struct {
	MchID      string `json:"mchId"`
	OrderId    string `json:"orderId"`
	OutTradeNo string `json:"outTradeNo"`
	PNO        string `json:"pno"`
	State      string `json:"state"`
	StateText  string `json:"stateText"`
	StateDate  string `json:"stateDate"`
}

type NotifyStatusFlashExpressErrorResponse struct {
	ErrorCode string `json:"errorCode"`
}

type NotifyStatusFlashExpressSuccessResponse struct {
	ErrorCode string `json:"errorCode"`
	State     string `json:"state"`
}

type NotifyStatusJTExpressTHRequest struct {
	LogisticInterface map[string]interface{} `json:"logistics_interface" mapstructure:"logistics_interface"`
	DataDigest        string                 `json:"data_digest" mapstructure:"data_digest"`
	MsgType           string                 `json:"msg_type" mapstructure:"msg_type"`
	EccompanyID       string                 `json:"eccompanyid" mapstructure:"eccompanyid"`
}

type NotifyStatusJTExpressTHRequestData struct {
	ID                 string                                 `json:"id" mapstructure:"id"`
	LogisticProviderID string                                 `json:"logisticproviderid" mapstructure:"logisticproviderid"`
	BillCode           string                                 `json:"billcode" mapstructure:"billcode"`
	TxLogisticID       string                                 `json:"txlogisticid" mapstructure:"txlogisticid"`
	Traces             []NotifyStatusJTExpressTHRequestTraces `json:"traces" mapstructure:"traces"`
}

type NotifyStatusJTExpressTHRequestTraces struct {
	ScanType         string  `json:"scanType" mapstructure:"scanType"`
	ScanTime         string  `json:"scanTime" mapstructure:"scanTime"`
	EntrySite        string  `json:"entrySite" mapstructure:"entrySite"`
	Weight           float64 `json:"weight" mapstructure:"weight"`
	Remark           string  `json:"remark" mapstructure:"remark"`
	Signer           string  `json:"signer" mapstructure:"signer"`
	City             string  `json:"city" mapstructure:"city"`
	SiteType         string  `json:"siteType" mapstructure:"siteType"`
	SiteName         string  `json:"siteName" mapstructure:"siteName"`
	DifficultiesType string  `json:"difficultiesType" mapstructure:"difficultiesType"`
}

type NotifyStatusJTExpressTHResponse struct {
	LogisticProviderID string                              `json:"logisticproviderid" mapstructure:"logisticproviderid"`
	ResponseItems      NotifyStatusJTExpressTHResponseItem `json:"responseitems" mapstructure:"responseitems"`
}

type NotifyStatusJTExpressTHResponseItem struct {
	Success      string `json:"success" mapstructure:"success"`
	Reason       string `json:"reason" mapstructure:"reason"`
	BillCode     string `json:"billcode" mapstructure:"billcode"`
	TxLogisticID string `json:"txlogisticid" mapstructure:"txlogisticid"`
}

type NotifyCourierFlashExpressRequest struct {
	MchID    string                               `json:"mchId"`
	NonceStr string                               `json:"nonceStr"`
	Sign     string                               `json:"sign"`
	Data     NotifyCourierFlashExpressRequestData `json:"data"`
}

type NotifyCourierFlashExpressRequestData struct {
	TicketPickupID        string `json:"ticketPickupId"`
	CurrentTicketPickupID string `json:"currentTicketPickupId"`
	State                 string `json:"state"` // 0:Pending assign - 1:Pending pickup - 2:Picked up - 3:Transferred - 4:Cancelled
	StateText             string `json:"stateText"`
	CancelReasonText      string `json:"cancelReasonText"`
	CancelOperatorID      string `json:"cancelOperatorId"`
	CancelReasonCode      string `json:"cancelReasonCode"`
	UpdateAt              string `json:"updateAt"`
}

/*
NotifyStatusJTExpressMYRequest
{
    "msg_type": "TRACKQUERY",
    "eccompanyid": "JT",
    "data_digest": "M2U3ODdiMzVkMDFlMjljOTY5ZGEzOWJi NWQ3MTc0OTU=",
    "logistics_interface": "json"
}
*/
type NotifyStatusJTExpressMYRequest struct {
	LogisticInterface string `json:"logistics_interface" mapstructure:"logistics_interface"`
	DataDigest        string `json:"data_digest" mapstructure:"data_digest"`
	MsgType           string `json:"msg_type" mapstructure:"msg_type"`
	EccompanyID       string `json:"eccompanyid" mapstructure:"eccompanyid"`
}

/*
NotifyStatusJTExpressMYRequestData
{
    "awb": "630020143933",
    "detail": {
        "actual_amount": 8.48,
        "services_code": "EZ",
        "services_type": "1",
        "shipped_date": "2022-02-16 17:58:15",
        "weight": 2.0
    },
    "history": [{
        "city_name": "J&T ",
        "date_time": "2022-02-16 17:58:15",
        "status": "Order Success",
        "status_code": 101
    }]
}
*/
type NotifyStatusJTExpressMYRequestData struct {
	BillCode string                                      `json:"awb" mapstructure:"awb"`
	Detail   NotifyStatusJTExpressMYRequestDataDetail    `json:"detail" mapstructure:"detail"`
	History  []NotifyStatusJTExpressMYRequestDataHistory `json:"history" mapstructure:"history"`
}

type NotifyStatusJTExpressMYRequestDataDetail struct {
	ActualAmount float64 `json:"actual_amount" mapstructure:"actual_amount"`
	ServicesCode string  `json:"services_code" mapstructure:"services_code"`
	ServicesType string  `json:"services_type" mapstructure:"services_type"`
	ShippedDate  string  `json:"shipped_date" mapstructure:"shipped_date"`
	Weight       float64 `json:"weight" mapstructure:"weight"`
}

type NotifyStatusJTExpressMYRequestDataHistory struct {
	CityName   string `json:"city_name" mapstructure:"city_name"`
	DateTime   string `json:"date_time" mapstructure:"date_time"`
	StatusText string `json:"status" mapstructure:"status"`
	StatusCode int    `json:"status_code" mapstructure:"status_code"`
}

type NotifyStatusJTExpressMYResponse struct {
	LogisticProviderID string                              `json:"logisticproviderid" mapstructure:"logisticproviderid"`
	ResponseItems      NotifyStatusJTExpressMYResponseItem `json:"responseitems" mapstructure:"responseitems"`
}

type NotifyStatusJTExpressMYResponseItem struct {
	Success  string `json:"success" mapstructure:"success"`
	Reason   string `json:"reason" mapstructure:"reason"`
	BillCode string `json:"billcode" mapstructure:"billcode"`
}

type NotifyStatusJTExpressSGRequest struct {
	Status          string `json:"status" mapstructure:"status"`
	TrackingID      string `json:"tracking_id" mapstructure:"tracking_id"`
	ReferenceNumber string `json:"reference_number" mapstructure:"reference_number"`
	Timestamp       string `json:"timestamp" mapstructure:"timestamp"`

	// status DELIVERED
	PodURL string `json:"pod_url,omitempty" mapstructure:"pod_url"`

	// status FAILED_DELIVERY
	NoOfAttempts int    `json:"no_of_attempts,omitempty" mapstructure:"no_of_attempts"`
	Comments     string `json:"comments,omitempty" mapstructure:"comments"`
}

type NotifyStatusKerryExpressTHRequest struct {
	TrackingID string `json:"trackingID" mapstructure:"trackingID"`
	StatusCode string `json:"statusCode" mapstructure:"statusCode"`
	StatusDate string `json:"statusDate" mapstructure:"statusDate"`
}
