package model

import (
	"time"

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

// 采购单
type PaperBill struct {
	//名字
	Name string `bson:"name,omitempty" json:"name"`
	//规格
	Norm string `bson:"norm,omitempty" json:"norm"`

	//宽
	Width string `bson:"width,omitempty" json:"width"`

	//长
	Height string `bson:"height,omitempty" json:"height"`

	Price      float64 `bson:"price,omitempty" json:"price"`
	Price2     float64 `bson:"price2,omitempty" json:"price2"`
	PriceUnit  string  `bson:"priceUnit,omitempty" json:"priceUnit"`
	Price2Unit string  `bson:"price2Unit,omitempty" json:"price2Unit"`

	// 下单数量
	OrderCount int `bson:"orderCount,omitempty" json:"orderCount"`

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

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

	//备注
	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`

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

type PurchaseBill struct {
	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	PackId     primitive.ObjectID `bson:"packId,omitempty" json:"packId"`
	PlanId     primitive.ObjectID `bson:"planId,omitempty" json:"planId"`
	SupplierId primitive.ObjectID `bson:"supplierId,omitempty" json:"supplierId"`
	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
	UserName   string             `bson:"userName,omitempty" json:"userName"`
	//类别
	Type string `bson:"type,omitempty" json:"type"`

	// 进行中 created  已完成 complete 已弃用 deprecated  已审核 reviewed
	Status       string               `bson:"status,omitempty" json:"status"`
	Reviewed     int                  `bson:"reviewed,omitempty" json:"reviewed"`   // -1 代表未审核 1已审核
	SignUsers    []primitive.ObjectID `bson:"signUsers,omitempty" json:"signUsers"` // 多个签名人
	CreateTime   time.Time            `bson:"createTime,omitempty" json:"createTime"`
	UpdateTime   time.Time            `bson:"updateTime,omitempty" json:"updateTime"`
	CompleteTime time.Time            `bson:"completeTime,omitempty" json:"completeTime"`

	//供应商
	Supplier string `bson:"supplier,omitempty" json:"supplier"`

	//送货地址
	SendTo string `bson:"sendTo,omitempty" json:"sendTo"`

	//商品名字
	ProductName string `bson:"productName,omitempty" json:"productName"`

	//纸张类采购
	Paper []*PaperBill `bson:"papers,omitempty" json:"papers"`

	// 序号
	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`

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

	// 单据类型
	BillType string `bson:"billType,omitempty" json:"billType"`
}

// 工艺生产数据
type ProduceBillData struct {
	//名字
	Name string `bson:"name,omitempty" json:"name"`

	//规格(质量要求)
	Norm string `bson:"norm,omitempty" json:"norm"`

	//单价 数量
	Price float64 `bson:"price,omitempty" json:"price"`

	Price2 float64 `bson:"price2,omitempty" json:"price2"` // 对应unit2

	// 下单数量
	OrderCount int `bson:"orderCount,omitempty" json:"orderCount"`

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

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

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

	//纸张
	Paper string `bson:"paper,omitempty" json:"paper"`

	//来纸尺寸
	PaperSize string `bson:"paperSize,omitempty" json:"paperSize"`

	//印刷尺寸/覆膜尺寸
	PrintSize string `bson:"printSize,omitempty" json:"printSize"`

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

	Unit  string `bson:"unit,omitempty" json:"unit"`
	Unit2 string `bson:"unit2,omitempty" json:"unit2"`
}

type ProduceBill struct {
	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	PackId     primitive.ObjectID `bson:"packId,omitempty" json:"packId"`
	PlanId     primitive.ObjectID `bson:"planId,omitempty" json:"planId"`
	SupplierId primitive.ObjectID `bson:"supplierId,omitempty" json:"supplierId"`
	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
	UserName   string             `bson:"userName,omitempty" json:"userName"`

	// 类别
	Type string `bson:"type,omitempty" json:"type"`

	// 进行中 created  已完成 complete 已弃用 deprecated
	Status       string               `bson:"status,omitempty" json:"status"`
	Reviewed     int                  `bson:"reviewed,omitempty" json:"reviewed"`   // -1 代表未审核 1已审核
	SignUsers    []primitive.ObjectID `bson:"signUsers,omitempty" json:"signUsers"` // 多个签名人
	CreateTime   time.Time            `bson:"createTime,omitempty" json:"createTime"`
	UpdateTime   time.Time            `bson:"updateTime,omitempty" json:"updateTime"`
	CompleteTime time.Time            `bson:"completeTime,omitempty" json:"completeTime"`

	//供应商
	Supplier string `bson:"supplier,omitempty" json:"supplier"`

	//送货地址
	SendTo string `bson:"sendTo,omitempty" json:"sendTo"`

	//商品名字
	ProductName string `bson:"productName,omitempty" json:"productName"`

	//纸张类采购
	Produces []*ProduceBillData `bson:"produces,omitempty" json:"produces"`

	// 序号
	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`

	IsPrint bool `bson:"isPrint,omitempty" json:"isPrint"`
	IsLam   bool `bson:"isLam,omitempty" json:"isLam"`

	// 单据类型
	BillType string `bson:"billType,omitempty" json:"billType"`
}

// 成品采购单据
type ProductBill struct {
	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	PackId     primitive.ObjectID `bson:"packId,omitempty" json:"packId"`
	PlanId     primitive.ObjectID `bson:"planId,omitempty" json:"planId"`
	SupplierId primitive.ObjectID `bson:"supplierId,omitempty" json:"supplierId"`
	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
	UserName   string             `bson:"userName,omitempty" json:"userName"`

	// 类别
	Type string `bson:"type,omitempty" json:"type"`

	// 进行中 created  已完成 complete 已弃用 deprecated
	Status       string               `bson:"status,omitempty" json:"status"`
	Reviewed     int                  `bson:"reviewed,omitempty" json:"reviewed"`   // -1 代表未审核 1已审核
	SignUsers    []primitive.ObjectID `bson:"signUsers,omitempty" json:"signUsers"` // 多个签名人
	CreateTime   time.Time            `bson:"createTime,omitempty" json:"createTime"`
	UpdateTime   time.Time            `bson:"updateTime,omitempty" json:"updateTime"`
	CompleteTime time.Time            `bson:"completeTime,omitempty" json:"completeTime"`

	//供应商
	Supplier string `bson:"supplier,omitempty" json:"supplier"`

	//送货地址
	SendTo string `bson:"sendTo,omitempty" json:"sendTo"`

	//商品名字
	ProductName string `bson:"productName,omitempty" json:"productName"`

	//有哪些成品采购数据
	Products []*ProductBillData `bson:"products,omitempty" json:"products"`

	// 序号
	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`

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

	// 单据类型
	BillType string `bson:"billType,omitempty" json:"billType"`
}

// 工艺生产数据
type ProductBillData struct {
	//名字
	Name string `bson:"name,omitempty" json:"name"`

	//规格(质量要求)
	Norm string `bson:"norm,omitempty" json:"norm"`

	//单价 数量
	Price float64 `bson:"price,omitempty" json:"price"`

	// 下单数量
	OrderCount int `bson:"orderCount,omitempty" json:"orderCount"`

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

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

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

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

	//纸张
	Unit string `bson:"unit,omitempty" json:"unit"`
}