package dto

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)

type DividendsOrder struct {
	Company struct {
		CompanyID   int    `json:"companyId,string"`
		CompanyLogo string `json:"companyLogo"`
		CompanyName string `json:"companyName"`
	} `json:"company"`
	CustomerName              string  `json:"customerName"`              //客户名字
	DividendStatus            int     `json:"dividendStatus"`            //分红订单分红状态,1待分红,2已分红,3部分分红
	DividendTime              int64   `json:"dividendTime"`              //分红订单分红时间
	DividendsOrderAmount      float64 `json:"dividendsOrderAmount"`      //分红订单金额
	DividendsOrderID          int     `json:"dividendsOrderId,string,"`  //分红订单
	DividendsOrderNumber      string  `json:"dividendsOrderNumber"`      //分红订单号
	DividendsOriginalOrderNum string  `json:"dividendsOriginalOrderNum"` //分红订单原单号
	OrderTime                 int64   `json:"orderTime"`                 //订单日日期 13位毫秒输出
	Org                       struct {
		OrgID   int    `json:"orgId,string"`
		OrgName string `json:"orgName"`
	} `json:"org"`
	Region struct {
		RegionName   string `json:"regionName"`
		RegionNumber string `json:"regionNumber"`
	} `json:"region"`
	Remarks string                                            `json:"remarks"`
	Goods   []allied_creation_cooperation.DividendsOrderGoods `json:"goods"`
}

func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
	data := DividendsOrder{
		Company:                   param.Company,
		CustomerName:              param.CustomerName,
		DividendStatus:            param.DividendStatus,
		DividendTime:              param.DividendTime.UnixNano() / 1e6,
		DividendsOrderAmount:      param.DividendsOrderAmount,
		DividendsOrderID:          param.DividendsOrderID,
		DividendsOrderNumber:      param.DividendsOrderNumber,
		DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
		OrderTime:                 param.OrderTime.UnixNano() / 1e6, //转为毫米输出
		Org:                       param.Org,
		Region:                    param.Region,
		Remarks:                   param.Remarks,
		Goods:                     param.Goods,
	}
	return &data
}