package app

import (
	"miniapp/global"
	"miniapp/model/common/constant"
	"miniapp/model/types"
)

type User struct {
	global.GVA_MODEL
	Phone         string              `json:"phone" gorm:"index:deleted;type:varchar(255) not null comment '手机号'"`
	WechatUnionId *string             `json:"wechat_union_id" gorm:"type:varchar(255) comment '微信UnionId'"`
	WechatOpenId  *string             `json:"wechat_open_id" gorm:"type:varchar(255) comment '微信OpenId'"`
	Nickname      string              `json:"nickname" gorm:"type:varchar(255) comment '昵称'"`
	Avatar        string              `json:"avatar" gorm:"type:varchar(255) comment '头像'"`
	Status        constant.UserStatus `json:"status" gorm:"type:enum('NORMAL','DISABLE'); default:'NORMAL'; not null; comment:'状态 NORMAL-正常；DISABLE-禁用'"`
	IsSurgery     int                 `json:"isSurgery" gorm:"default:0;comment:是否已经手术 0未手术 1已手术"`
	IsInfo        int                 `json:"isInfo" gorm:"default:0;comment:是否已经填写信息 0未填写 1已填写"`
	HospitalId    int                 `json:"hospital_id" gorm:"comment:手术医院"`
	SurgeryTime   *types.DateTime     `json:"surgery_time" gorm:"comment:手术时间"`
	LastLoginAt   *types.DateTime     `json:"last_login_at" gorm:"comment:'最后登录时间'"`
}

func (User) TableName() string {
	return "t_user"
}
