package comm

import (
	"time"

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

type CategoryNode struct {
	Id       string          `bson:"id,omitempty" json:"id"` //分类Id
	Type     string          `bson:"type,omitempty" json:"type"`
	Name     string          `bson:"name,omitempty" json:"name"`
	Value    string          `bson:"value,omitempty" json:"value"`
	IsEdit   *bool           `bson:"isEdit,omitempty" json:"isEdit"`
	Cover    string          `bson:"cover,omitempty" json:"cover"`
	Children []*CategoryNode `bson:"children,omitempty" json:"children"` //是否是叶子节点
}

type DbCategory struct {
	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`       //Id
	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"` //用户Id
	Scope      string             `bson:"scope,omitempty" json:"scope"`   //用户标签
	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
	Categories []*CategoryNode    `bson:"categories,omitempty" json:"categories" complex:"true"` //所有树形分类定义
}

type DbAssetCategory struct {
	DbAssetId   primitive.ObjectID `bson:"dbAssetConfId,omitempty" json:"dbAssetConfId"` //资产定义Id
	CategoryIds []string           `bson:"categoryIds,omitempty" json:"categoryIds"`
}

type DbAssetUserCategory struct {
	Id     primitive.ObjectID `bson:"_id,omitempty" json:"_id"`       //用户的资产分类定义
	UserId primitive.ObjectID `bson:"userId,omitempty" json:"userId"` //用户Id
	Scope  string             `bson:"scope,omitempty" json:"scope"`   //企业账号还是个人账号

	CreateTime    time.Time          `bson:"createTime,omitempty" json:"createTime"`                      //创建时间
	UpdateTime    time.Time          `bson:"updateTime,omitempty" json:"updateTime"`                      //更新时间
	CategoryConfs []*DbAssetCategory `bson:"categoryConfs,omitempty" json:"categoryConfs" complex:"true"` //更新时间
}