package model

import (
	"time"

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

type User struct {
	Id        primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NickName  string             `bson:"nickName,omitempty" json:"nickName,omitempty"`
	LoginName string             `bson:"loginName,omitempty" json:"loginName,omitempty"`
	Password  string             `bson:"password,omitempty" json:"password,omitempty"`
	Avatar    string             `bson:"avatar,omitempty" json:"avatar,omitempty"`
	// student,teacher,admin
	Roles      []string  `bson:"roles,omitempty" json:"roles,omitempty"`
	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime,omitempty"`
	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime,omitempty"`
}

func (m *User) GetID() string {
	return m.Id.Hex()
}
