package model

import (
	"time"

	"go.mongodb.org/mongo-driver/bson/primitive"
)

// 包装
type Pack struct {
	Id        primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name      string             `bson:"name,omitempty" json:"name"`
	Thumbnail string             `bson:"thumbnail,omitempty" json:"thumbnail"`
	// 部件数量
	CompCounts int `bson:"compCounts,omitempty" json:"compCounts"`
	// 设计师
	Designer string `bson:"designer,omitempty" json:"designer"`
	// 组成包装的部件
	Components []*PackComponent `bson:"components,omitempty" json:"components"`
	CreateTime time.Time        `bson:"createTime,omitempty" json:"createTime"`
	UpdateTime time.Time        `bson:"updateTime,omitempty" json:"updateTime"`
}

type PackComponent struct {
	Id        string `bson:"id,omitempty" json:"id"`
	Name      string `bson:"name,omitempty" json:"name"`
	Thumbnail string `bson:"thumbnail,omitempty" json:"thumbnail"`
	//数量
	Count int `bson:"count,omitempty" json:"count"`

	//刀版图
	Uv string `bson:"uv,omitempty" json:"uv"`

	//部件尺寸
	UvSize string `bson:"uvSize,omitempty" json:"uvSize"`

	//所有材料
	Mats []*PackComponentMat `bson:"mats,omitempty" json:"mats"`

	Remark string `bson:"remark,omitempty" json:"remark"`

	//部件总价
	TotalPrice float64 `bson:"totalPrice,omitempty" json:"totalPrice"`
}

type SupplierPriceVo struct {
	Calc *PriceCalc `bson:"calc,omitempty" json:"calc"` //计价策略

	//交货时间
	DeliveryTime *time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`

	//订单单价
	OrderPrice float64 `bson:"orderPrice,omitempty" json:"orderPrice"`

	//订单数据量
	OrderCount float64 `bson:"orderCount,omitempty" json:"orderCount"`

	//订单实际金额
	OrderRealPrice float32 `bson:"orderRealPrice,omitempty" json:"orderRealPrice"`

	//供应商信息
	SupplierInfo *Supplier `bson:"supplierInfo,omitempty" json:"supplierInfo"`
}

type PackComponentMat struct {
	Id string `bson:"id,omitempty" json:"id"`

	//所有工艺
	Crafts []*PackComponentMatCraft `bson:"crafts,omitempty" json:"crafts"`

	MatInfo *Material `bson:"matInfo,omitempty" json:"matInfo"`

	Supplier *SupplierPriceVo `bson:"supplier,omitempty" json:"supplier"`

	BatchCount      int `bson:"batchCount,omitempty" json:"batchCount"`           //拼版数量
	BatchSizeWidth  int `bson:"batchSizeWidth,omitempty" json:"batchSizeWidth"`   //平板尺寸
	BatchSizeHeight int `bson:"batchSizeHeight,omitempty" json:"batchSizeHeight"` //平板尺寸

	BillId string `bson:"billId,omitempty" json:"billId"`

	Remark string `bson:"remark,omitempty" json:"remark"` //备注

	//确认收货数量
	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
}

type PackComponentMatCraft struct {
	Id string `bson:"id,omitempty" json:"id"`

	//工艺尺寸
	Size string `bson:"size,omitempty" json:"size"`

	//工艺数量
	Count int `bson:"count,omitempty" json:"count"`

	//工艺信息
	CraftInfo *Craft `bson:"craftInfo,omitempty" json:"craftInfo"` //材料Id

	Supplier *SupplierPriceVo `bson:"supplier,omitempty" json:"supplier"`

	BatchCount      int `bson:"batchCount,omitempty" json:"batchCount"`           //拼版数量
	BatchSizeWidth  int `bson:"batchSizeWidth,omitempty" json:"batchSizeWidth"`   //平板尺寸
	BatchSizeHeight int `bson:"batchSizeHeight,omitempty" json:"batchSizeHeight"` //平板尺寸

	BillId string `bson:"billId,omitempty" json:"billId"`

	Remark string `bson:"remark,omitempty" json:"remark"` //备注

	//确认收货数量
	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
}