package models

import (
	"time"

	"github.com/shopspring/decimal"

	"go-admin/common/models"
)

type LineUser struct {
	models.Model

	GroupId          int             `json:"groupId" gorm:"type:int unsigned;comment:组别ID"`
	Pid              int             `json:"pid" gorm:"type:int unsigned;comment:直接推荐人ID"`
	TopReferrerId    int             `json:"topReferrerId" gorm:"type:int unsigned;comment:父级推荐人ID"`
	Username         string          `json:"username" gorm:"type:varchar(32);comment:用户名"`
	Nickname         string          `json:"nickname" gorm:"type:varchar(50);comment:昵称"`
	Password         string          `json:"password" gorm:"type:varchar(50);comment:密码"`
	Salt             string          `json:"salt" gorm:"type:varchar(30);comment:密码盐"`
	Email            string          `json:"email" gorm:"type:varchar(100);comment:电子邮箱"`
	Mobile           string          `json:"mobile" gorm:"type:varchar(11);comment:手机号"`
	Area             string          `json:"area" gorm:"type:varchar(255);comment:手机号归属地"`
	Avatar           string          `json:"avatar" gorm:"type:varchar(255);comment:头像"`
	Level            int             `json:"level" gorm:"type:tinyint unsigned;comment:等级"`
	Gender           int             `json:"gender" gorm:"type:tinyint unsigned;comment:性别"`
	Bio              string          `json:"bio" gorm:"type:varchar(100);comment:格言"`
	Money            decimal.Decimal `json:"money" gorm:"type:decimal(10,2) unsigned;comment:保证金"`
	Score            int             `json:"score" gorm:"type:int unsigned;comment:积分"`
	InviteCode       string          `json:"invite_code" gorm:"type:varchar(255);comment:邀请码"`
	Successions      int             `json:"successions" gorm:"type:int unsigned;comment:连续登录天数"`
	MaxSuccessions   int             `json:"maxSuccessions" gorm:"type:int unsigned;comment:最大连续登录天数"`
	Loginip          string          `json:"loginip" gorm:"type:varchar(50);comment:登录IP"`
	Loginfailure     int             `json:"loginfailure" gorm:"type:tinyint unsigned;comment:失败次数"`
	Joinip           string          `json:"joinip" gorm:"type:varchar(50);comment:加入IP"`
	Jointime         int             `json:"jointime" gorm:"type:int;comment:加入时间"`
	RecommendNum     int             `json:"recommend_num" gorm:"type:int;comment:推荐人数"`
	Token            string          `json:"token" gorm:"type:varchar(50);comment:Token"`
	Status           string          `json:"status" gorm:"type:varchar(30);comment:状态"`
	Verification     string          `json:"verification" gorm:"type:varchar(255);comment:验证"`
	LoginTime        time.Time       `json:"loginTime" gorm:"type:timestamp;comment:登录时间"`
	ExpirationTime   *time.Time      `json:"expirationTime" gorm:"type:timestamp;comment:过期时间"`
	OpenStatus       int             `json:"open_status" gorm:"-"`
	SpotFreeAmount   decimal.Decimal `json:"spotFreeAmount" gorm:"-"`
	FutureFreeAmount decimal.Decimal `json:"futureFreeAmount" gorm:"-"`
	AssetUpdateTime  *time.Time      `json:"assetUpdateTime" gorm:"-"`
	MinOrderAmount   decimal.Decimal `json:"minOrderAmount" gorm:"-"`
	models.ModelTime
	models.ControlBy
}

func (LineUser) TableName() string {
	return "line_user"
}

func (e *LineUser) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *LineUser) GetId() interface{} {
	return e.Id
}
