package protocol

/*OrderDetail */
type OrderDetailRequest struct {
	Id int64 `json:"id"`
}
type OrderDetailResponse struct {
	Order interface{} `json:"order"`
}

//type OrderDetail struct {
//	Id                int64       `json:"id"`
//	OrderNo           string      `json:"orderNo"`
//	OrderName         string      `json:"orderName"`
//	OrderStatus       int         `json:"orderStatus"`
//	CreateTime        int64       `json:"createTime"`
//	UpdateTime        int64       `json:"updateTime"`
//	OrderQuantity     int         `json:"orderQuantity"`
//	OrderAmount       float64     `json:"orderAmount"`
//	OrderAmountCancel float64     `json:"orderAmountCancel"`
//	OrderUpdateReason string      `json:"orderUpdateReason"`
//	OrderDistrict     interface{} `json:"orderDistrict"`
//	Customer          Customer    `json:"customer"`
//	MyDividend        float64     `json:"myDividend"`
//	MyDividendPercent float64     `json:"myDividendPercent"`
//}

type OrderDetail struct {
	Id            int64       `json:"id"`
	OrderNo       string      `json:"orderNo"`     //订单号
	DeliveryNo    string      `json:"deliveryNo"`  //发货单号
	OrderStatus   int         `json:"orderStatus"` //订单状态 1.待支付 2.已支付 3.已支付退货  4待支付退货
	CreateTime    int64       `json:"createTime"`
	UpdateTime    int64       `json:"updateTime"`
	SalesTime     int64       `json:"salesTime"` // 销售日期
	OrderDistrict interface{} `json:"orderDistrict"`
	Customer      Customer    `json:"customer"`
	Products      interface{} `json:"products"`
	Total         interface{} `json:"total"`
}

type Customer struct {
	Uname string `json:"uname"`
	Phone string `json:"phone"`
}

/*OrderStatistics */
type OrderStatisticsRequest struct {
	PartnerId int64 `json:"partnerId"`
}
type OrderStatisticsResponse struct {
	Statistics *OrderStatics `json:"statistics,omitempty"`
	Career     OrderStatic   `json:"career,omitempty"`   //事业
	Business   OrderStatic   `json:"business,omitempty"` //业务
	Develop    OrderStatic   `json:"develop,omitempty"`  //开发
	App        OrderStatic   `json:"app,omitempty"`      //业务-产品应用
}
type OrderStatics struct {
	TodayIntentionQuantity int     `json:"-"`                  //今日新增意向订单
	TodayIntentionMoney    float64 `json:"-"`                  //今日新增意向订单金额
	TodayRealQuantity      int     `json:"todayRealQuantity"`  //今日新增实发订单
	TodayRealMoney         float64 `json:"todayRealMoney"`     //今日新增实发订单金额
	CumulativeQuantity     int     `json:"cumulativeQuantity"` //累计实发订单
	CumulativeMoney        float64 `json:"cumulativeMoney"`    //累计实发订单金额

	//v0.3.0 新增加
	CareerPercent   float64 `json:"careerPercent"`   // 事业占比
	BusinessPercent float64 `json:"businessPercent"` // 业务占比
	DevelopPercent  float64 `json:"developPercent"`  // 研发占比
	AppPercent      float64 `json:"appPercent"`      // 研发占比
	BusinessMoney   float64 `json:"businessMoney"`   // 业务分红累计
}

type OrderStatic struct {
	Percent            float64 `json:"percent"`            // 事业占比
	TodayRealQuantity  int     `json:"todayRealQuantity"`  //今日新增实发订单
	TodayRealMoney     float64 `json:"todayRealMoney"`     //今日新增实发订单金额
	CumulativeQuantity int     `json:"cumulativeQuantity"` //累计实发订单
	CumulativeMoney    float64 `json:"cumulativeMoney"`    //累计实发订单金额
}

/*OrderList */
type OrderListRequest struct {
	StartTime   int64 `json:"startTime"`
	EndTime     int64 `json:"endTime"`
	OrderAction int   `json:"orderAction"` //订单Action(0全部订单、1部分发货、2全部发货)
	PageIndex   int   `json:"pageIndex"`
	PageSize    int   `json:"pageSize" valid:"Required"`
	OrderType   int   `json:"-"`
	OrderTypes  []int `json:"-"`
	IsToday     bool  `json:"isToday"`
	PartnerId   int64 `json:"partnerId"`
	JoinWay     int   `json:"joinWay"` //合伙方式(0或不传,即所有合伙方式)
}
type OrderListResponse struct {
	List       []*OrderListItem       `json:"list"`
	Statistics map[string]interface{} `json:"-"`
	Total      int                    `json:"total"`
	Timestamp  int64                  `json:"timestamp"`
}

type OrderListItem struct {
	//id
	Id int64 `json:"id,omitempty"`
	//订单类型
	OrderType int `json:"orderType"`
	//订单编号
	OrderNo string `json:"-"`
	//发货编号
	DeliveryNo string `json:"deliveryNo"`
	//订单名称
	OrderName string `json:"-"`
	//订单状态
	OrderStatus int `json:"-"`
	//实际订单数量
	OrderActualCount int `json:"-"`
	// 订单区域
	OrderDistrict map[string]interface{} `json:"orderDistrict"`
	//订单金额
	OrderAmount float64 `json:"orderAmount"`
	// 订单更新时间
	UpdateTime int64 `json:"updateTime"`
	//销售时间
	SalesTime int64 `json:"salesTime"`
	//我的分红
	MyDividend float64 `json:"dividendReceivable"`
	//是否已读(0未读,1已读)
	IsRead int `json:"isRead"`
}