package system

import (
	"sundynix-go/global"
)

type Login interface {
	GetAccount() string
	GetUserId() string
	GetUserInfo() any
}
type User struct {
	global.BaseModel
	TenantId   string `gorm:"size:20;" json:"tenantId" form:"tenantId"`
	ClientId   string `gorm:"size:20;" json:"clientId"`
	Name       string `gorm:"size:20" json:"name" form:"name"`
	Account    string `gorm:"size:11;" json:"account" form:"account"`
	Password   string `gorm:"size:100;" json:"-" form:"password"`
	NickName   string `gorm:"size:20;column:nick_name" json:"nickName" form:"nickName"`
	Phone      string `gorm:"size:20;column:phone" json:"phone" form:"phone"`
	SessionKey string `gorm:"size:80;column:session_key" json:"sessionKey" form:"sessionKey"`
	UnionId    string `gorm:"size:80;column:union_id" json:"unionId"`
	MiniOpenId string `gorm:"size:80;column:mini_open_id" json:"miniOpenId" form:"miniOpenId"`
	SaOpenId   string `gorm:"size:80;column:sa_open_id" json:"saOpenId"`
	AvatarId   string `gorm:"size:50;column:avatar_id" json:"avatarId"`
	Avatar     *Oss   `gorm:"foreignKey:AvatarId" json:"avatar"`
}

func (u *User) GetAccount() string {
	return u.Account
}
func (u *User) GetUserId() string {
	return u.Id
}

func (u *User) GetUserInfo() any {
	return *u
}
