package models

import (
	"time"
)

// User represents the users table
// Web3 native: wallet_address is the primary key (no numeric id, no auth_user_id)
type User struct {
	WalletAddress      string     `gorm:"primaryKey;size:42" json:"wallet_address"`
	Nickname           string     `gorm:"size:100" json:"nickname"`
	Avatar             string     `gorm:"type:text" json:"avatar"`
	Bio                string     `gorm:"type:text" json:"bio"`
	ReferrerWallet     *string    `gorm:"size:42;index" json:"referrer_wallet,omitempty"`
	InviteCode         string     `gorm:"size:20;unique;index" json:"invite_code"`
	DirectInvitesCount int        `gorm:"default:0" json:"direct_invites_count"`
	MemberTier         string     `gorm:"size:50;default:'Bronze'" json:"member_tier"`
	VIPLevel           int        `gorm:"default:1" json:"vip_level"`
	TotalPoints        int64      `gorm:"default:0" json:"total_points"`
	GlobalRank         *int       `gorm:"index" json:"global_rank,omitempty"`
	CreatedAt          time.Time  `json:"created_at"`
	UpdatedAt          time.Time  `json:"updated_at"`
}

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