// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// UserEmpty represents TL type `userEmpty#d3bc4b7a`.
// Empty constructor, non-existent user.
//
// See https://core.telegram.org/constructor/userEmpty for reference.
type UserEmpty struct {
	// User identifier or 0
	ID int64
}

// UserEmptyTypeID is TL type id of UserEmpty.
const UserEmptyTypeID = 0xd3bc4b7a

// construct implements constructor of UserClass.
func ( UserEmpty) () UserClass { return & }

// Ensuring interfaces in compile-time for UserEmpty.
var (
	_ bin.Encoder     = &UserEmpty{}
	_ bin.Decoder     = &UserEmpty{}
	_ bin.BareEncoder = &UserEmpty{}
	_ bin.BareDecoder = &UserEmpty{}

	_ UserClass = &UserEmpty{}
)

func ( *UserEmpty) () bool {
	if  == nil {
		return true
	}
	if !(.ID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *UserEmpty) () string {
	if  == nil {
		return "UserEmpty(nil)"
	}
	type  UserEmpty
	return fmt.Sprintf("UserEmpty%+v", (*))
}

// FillFrom fills UserEmpty from given interface.
func ( *UserEmpty) ( interface {
	() ( int64)
}) {
	.ID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*UserEmpty) () uint32 {
	return UserEmptyTypeID
}

// TypeName returns name of type in TL schema.
func (*UserEmpty) () string {
	return "userEmpty"
}

// TypeInfo returns info about TL type.
func ( *UserEmpty) () tdp.Type {
	 := tdp.Type{
		Name: "userEmpty",
		ID:   UserEmptyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userEmpty#d3bc4b7a as nil")
	}
	.PutID(UserEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userEmpty#d3bc4b7a as nil")
	}
	.PutLong(.ID)
	return nil
}

// Decode implements bin.Decoder.
func ( *UserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userEmpty#d3bc4b7a to nil")
	}
	if  := .ConsumeID(UserEmptyTypeID);  != nil {
		return fmt.Errorf("unable to decode userEmpty#d3bc4b7a: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *UserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userEmpty#d3bc4b7a to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode userEmpty#d3bc4b7a: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *UserEmpty) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

// User represents TL type `user#215c4438`.
// Indicates info about a certain user
//
// See https://core.telegram.org/constructor/user for reference.
type User struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this user indicates the currently logged in user
	Self bool
	// Whether this user is a contact
	Contact bool
	// Whether this user is a mutual contact
	MutualContact bool
	// Whether the account of this user was deleted
	Deleted bool
	// Is this user a bot?
	Bot bool
	// Can the bot see all messages in groups?
	BotChatHistory bool
	// Can the bot be added to groups?
	BotNochats bool
	// Whether this user is verified
	Verified bool
	// Access to this user must be restricted for the reason specified in restriction_reason
	Restricted bool
	// See min¹
	//
	// Links:
	//  1) https://core.telegram.org/api/min
	Min bool
	// Whether the bot can request our geolocation in inline mode
	BotInlineGeo bool
	// Whether this is an official support user
	Support bool
	// This may be a scam user
	Scam bool
	// If set, the profile picture for this user should be refetched
	ApplyMinPhoto bool
	// If set, this user was reported by many users as a fake or scam user: be careful when
	// interacting with them.
	Fake bool
	// Whether this bot offers an attachment menu web app¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/attach
	BotAttachMenu bool
	// Whether this user is a Telegram Premium user
	Premium bool
	// Whether we installed the attachment menu web app¹ offered by this bot
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/attach
	AttachMenuEnabled bool
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags2 bin.Fields
	// Whether we can edit the profile picture, name, about text and description of this bot
	// because we own it.
	BotCanEdit bool
	// Whether we marked this user as a close friend, see here » for more info¹
	//
	// Links:
	//  1) https://core.telegram.org/api/privacy
	CloseFriend bool
	// Whether we have hidden »¹ all active stories of this user.
	//
	// Links:
	//  1) https://core.telegram.org/api/stories#hiding-stories-of-other-users
	StoriesHidden bool
	// No stories from this user are visible.
	StoriesUnavailable bool
	// ID of the user
	ID int64
	// Access hash of the user
	//
	// Use SetAccessHash and GetAccessHash helpers.
	AccessHash int64
	// First name
	//
	// Use SetFirstName and GetFirstName helpers.
	FirstName string
	// Last name
	//
	// Use SetLastName and GetLastName helpers.
	LastName string
	// Username
	//
	// Use SetUsername and GetUsername helpers.
	Username string
	// Phone number
	//
	// Use SetPhone and GetPhone helpers.
	Phone string
	// Profile picture of user
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo UserProfilePhotoClass
	// Online status of user
	//
	// Use SetStatus and GetStatus helpers.
	Status UserStatusClass
	// Version of the bot_info field in userFull¹, incremented every time it changes
	//
	// Links:
	//  1) https://core.telegram.org/constructor/userFull
	//
	// Use SetBotInfoVersion and GetBotInfoVersion helpers.
	BotInfoVersion int
	// Contains the reason why access to this user must be restricted.
	//
	// Use SetRestrictionReason and GetRestrictionReason helpers.
	RestrictionReason []RestrictionReason
	// Inline placeholder for this inline bot
	//
	// Use SetBotInlinePlaceholder and GetBotInlinePlaceholder helpers.
	BotInlinePlaceholder string
	// Language code of the user
	//
	// Use SetLangCode and GetLangCode helpers.
	LangCode string
	// Emoji status¹
	//
	// Links:
	//  1) https://core.telegram.org/api/emoji-status
	//
	// Use SetEmojiStatus and GetEmojiStatus helpers.
	EmojiStatus EmojiStatusClass
	// Additional usernames
	//
	// Use SetUsernames and GetUsernames helpers.
	Usernames []Username
	// ID of the maximum read story¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/stories
	//
	// Use SetStoriesMaxID and GetStoriesMaxID helpers.
	StoriesMaxID int
	// The user's accent color¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	//
	// Use SetColor and GetColor helpers.
	Color PeerColor
	// The user's profile color¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	//
	// Use SetProfileColor and GetProfileColor helpers.
	ProfileColor PeerColor
}

// UserTypeID is TL type id of User.
const UserTypeID = 0x215c4438

// construct implements constructor of UserClass.
func ( User) () UserClass { return & }

// Ensuring interfaces in compile-time for User.
var (
	_ bin.Encoder     = &User{}
	_ bin.Decoder     = &User{}
	_ bin.BareEncoder = &User{}
	_ bin.BareDecoder = &User{}

	_ UserClass = &User{}
)

func ( *User) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Self == false) {
		return false
	}
	if !(.Contact == false) {
		return false
	}
	if !(.MutualContact == false) {
		return false
	}
	if !(.Deleted == false) {
		return false
	}
	if !(.Bot == false) {
		return false
	}
	if !(.BotChatHistory == false) {
		return false
	}
	if !(.BotNochats == false) {
		return false
	}
	if !(.Verified == false) {
		return false
	}
	if !(.Restricted == false) {
		return false
	}
	if !(.Min == false) {
		return false
	}
	if !(.BotInlineGeo == false) {
		return false
	}
	if !(.Support == false) {
		return false
	}
	if !(.Scam == false) {
		return false
	}
	if !(.ApplyMinPhoto == false) {
		return false
	}
	if !(.Fake == false) {
		return false
	}
	if !(.BotAttachMenu == false) {
		return false
	}
	if !(.Premium == false) {
		return false
	}
	if !(.AttachMenuEnabled == false) {
		return false
	}
	if !(.Flags2.Zero()) {
		return false
	}
	if !(.BotCanEdit == false) {
		return false
	}
	if !(.CloseFriend == false) {
		return false
	}
	if !(.StoriesHidden == false) {
		return false
	}
	if !(.StoriesUnavailable == false) {
		return false
	}
	if !(.ID == 0) {
		return false
	}
	if !(.AccessHash == 0) {
		return false
	}
	if !(.FirstName == "") {
		return false
	}
	if !(.LastName == "") {
		return false
	}
	if !(.Username == "") {
		return false
	}
	if !(.Phone == "") {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.Status == nil) {
		return false
	}
	if !(.BotInfoVersion == 0) {
		return false
	}
	if !(.RestrictionReason == nil) {
		return false
	}
	if !(.BotInlinePlaceholder == "") {
		return false
	}
	if !(.LangCode == "") {
		return false
	}
	if !(.EmojiStatus == nil) {
		return false
	}
	if !(.Usernames == nil) {
		return false
	}
	if !(.StoriesMaxID == 0) {
		return false
	}
	if !(.Color.Zero()) {
		return false
	}
	if !(.ProfileColor.Zero()) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *User) () string {
	if  == nil {
		return "User(nil)"
	}
	type  User
	return fmt.Sprintf("User%+v", (*))
}

// FillFrom fills User from given interface.
func ( *User) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( int64)
	() ( int64,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( UserProfilePhotoClass,  bool)
	() ( UserStatusClass,  bool)
	() ( int,  bool)
	() ( []RestrictionReason,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( EmojiStatusClass,  bool)
	() ( []Username,  bool)
	() ( int,  bool)
	() ( PeerColor,  bool)
	() ( PeerColor,  bool)
}) {
	.Self = .()
	.Contact = .()
	.MutualContact = .()
	.Deleted = .()
	.Bot = .()
	.BotChatHistory = .()
	.BotNochats = .()
	.Verified = .()
	.Restricted = .()
	.Min = .()
	.BotInlineGeo = .()
	.Support = .()
	.Scam = .()
	.ApplyMinPhoto = .()
	.Fake = .()
	.BotAttachMenu = .()
	.Premium = .()
	.AttachMenuEnabled = .()
	.BotCanEdit = .()
	.CloseFriend = .()
	.StoriesHidden = .()
	.StoriesUnavailable = .()
	.ID = .()
	if ,  := .();  {
		.AccessHash = 
	}

	if ,  := .();  {
		.FirstName = 
	}

	if ,  := .();  {
		.LastName = 
	}

	if ,  := .();  {
		.Username = 
	}

	if ,  := .();  {
		.Phone = 
	}

	if ,  := .();  {
		.Photo = 
	}

	if ,  := .();  {
		.Status = 
	}

	if ,  := .();  {
		.BotInfoVersion = 
	}

	if ,  := .();  {
		.RestrictionReason = 
	}

	if ,  := .();  {
		.BotInlinePlaceholder = 
	}

	if ,  := .();  {
		.LangCode = 
	}

	if ,  := .();  {
		.EmojiStatus = 
	}

	if ,  := .();  {
		.Usernames = 
	}

	if ,  := .();  {
		.StoriesMaxID = 
	}

	if ,  := .();  {
		.Color = 
	}

	if ,  := .();  {
		.ProfileColor = 
	}

}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*User) () uint32 {
	return UserTypeID
}

// TypeName returns name of type in TL schema.
func (*User) () string {
	return "user"
}

// TypeInfo returns info about TL type.
func ( *User) () tdp.Type {
	 := tdp.Type{
		Name: "user",
		ID:   UserTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Self",
			SchemaName: "self",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Contact",
			SchemaName: "contact",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "MutualContact",
			SchemaName: "mutual_contact",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "Deleted",
			SchemaName: "deleted",
			Null:       !.Flags.Has(13),
		},
		{
			Name:       "Bot",
			SchemaName: "bot",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "BotChatHistory",
			SchemaName: "bot_chat_history",
			Null:       !.Flags.Has(15),
		},
		{
			Name:       "BotNochats",
			SchemaName: "bot_nochats",
			Null:       !.Flags.Has(16),
		},
		{
			Name:       "Verified",
			SchemaName: "verified",
			Null:       !.Flags.Has(17),
		},
		{
			Name:       "Restricted",
			SchemaName: "restricted",
			Null:       !.Flags.Has(18),
		},
		{
			Name:       "Min",
			SchemaName: "min",
			Null:       !.Flags.Has(20),
		},
		{
			Name:       "BotInlineGeo",
			SchemaName: "bot_inline_geo",
			Null:       !.Flags.Has(21),
		},
		{
			Name:       "Support",
			SchemaName: "support",
			Null:       !.Flags.Has(23),
		},
		{
			Name:       "Scam",
			SchemaName: "scam",
			Null:       !.Flags.Has(24),
		},
		{
			Name:       "ApplyMinPhoto",
			SchemaName: "apply_min_photo",
			Null:       !.Flags.Has(25),
		},
		{
			Name:       "Fake",
			SchemaName: "fake",
			Null:       !.Flags.Has(26),
		},
		{
			Name:       "BotAttachMenu",
			SchemaName: "bot_attach_menu",
			Null:       !.Flags.Has(27),
		},
		{
			Name:       "Premium",
			SchemaName: "premium",
			Null:       !.Flags.Has(28),
		},
		{
			Name:       "AttachMenuEnabled",
			SchemaName: "attach_menu_enabled",
			Null:       !.Flags.Has(29),
		},
		{
			Name:       "BotCanEdit",
			SchemaName: "bot_can_edit",
			Null:       !.Flags2.Has(1),
		},
		{
			Name:       "CloseFriend",
			SchemaName: "close_friend",
			Null:       !.Flags2.Has(2),
		},
		{
			Name:       "StoriesHidden",
			SchemaName: "stories_hidden",
			Null:       !.Flags2.Has(3),
		},
		{
			Name:       "StoriesUnavailable",
			SchemaName: "stories_unavailable",
			Null:       !.Flags2.Has(4),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "FirstName",
			SchemaName: "first_name",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "LastName",
			SchemaName: "last_name",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Username",
			SchemaName: "username",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Phone",
			SchemaName: "phone",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Status",
			SchemaName: "status",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "BotInfoVersion",
			SchemaName: "bot_info_version",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "RestrictionReason",
			SchemaName: "restriction_reason",
			Null:       !.Flags.Has(18),
		},
		{
			Name:       "BotInlinePlaceholder",
			SchemaName: "bot_inline_placeholder",
			Null:       !.Flags.Has(19),
		},
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
			Null:       !.Flags.Has(22),
		},
		{
			Name:       "EmojiStatus",
			SchemaName: "emoji_status",
			Null:       !.Flags.Has(30),
		},
		{
			Name:       "Usernames",
			SchemaName: "usernames",
			Null:       !.Flags2.Has(0),
		},
		{
			Name:       "StoriesMaxID",
			SchemaName: "stories_max_id",
			Null:       !.Flags2.Has(5),
		},
		{
			Name:       "Color",
			SchemaName: "color",
			Null:       !.Flags2.Has(8),
		},
		{
			Name:       "ProfileColor",
			SchemaName: "profile_color",
			Null:       !.Flags2.Has(9),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *User) () {
	if !(.Self == false) {
		.Flags.Set(10)
	}
	if !(.Contact == false) {
		.Flags.Set(11)
	}
	if !(.MutualContact == false) {
		.Flags.Set(12)
	}
	if !(.Deleted == false) {
		.Flags.Set(13)
	}
	if !(.Bot == false) {
		.Flags.Set(14)
	}
	if !(.BotChatHistory == false) {
		.Flags.Set(15)
	}
	if !(.BotNochats == false) {
		.Flags.Set(16)
	}
	if !(.Verified == false) {
		.Flags.Set(17)
	}
	if !(.Restricted == false) {
		.Flags.Set(18)
	}
	if !(.Min == false) {
		.Flags.Set(20)
	}
	if !(.BotInlineGeo == false) {
		.Flags.Set(21)
	}
	if !(.Support == false) {
		.Flags.Set(23)
	}
	if !(.Scam == false) {
		.Flags.Set(24)
	}
	if !(.ApplyMinPhoto == false) {
		.Flags.Set(25)
	}
	if !(.Fake == false) {
		.Flags.Set(26)
	}
	if !(.BotAttachMenu == false) {
		.Flags.Set(27)
	}
	if !(.Premium == false) {
		.Flags.Set(28)
	}
	if !(.AttachMenuEnabled == false) {
		.Flags.Set(29)
	}
	if !(.BotCanEdit == false) {
		.Flags2.Set(1)
	}
	if !(.CloseFriend == false) {
		.Flags2.Set(2)
	}
	if !(.StoriesHidden == false) {
		.Flags2.Set(3)
	}
	if !(.StoriesUnavailable == false) {
		.Flags2.Set(4)
	}
	if !(.AccessHash == 0) {
		.Flags.Set(0)
	}
	if !(.FirstName == "") {
		.Flags.Set(1)
	}
	if !(.LastName == "") {
		.Flags.Set(2)
	}
	if !(.Username == "") {
		.Flags.Set(3)
	}
	if !(.Phone == "") {
		.Flags.Set(4)
	}
	if !(.Photo == nil) {
		.Flags.Set(5)
	}
	if !(.Status == nil) {
		.Flags.Set(6)
	}
	if !(.BotInfoVersion == 0) {
		.Flags.Set(14)
	}
	if !(.RestrictionReason == nil) {
		.Flags.Set(18)
	}
	if !(.BotInlinePlaceholder == "") {
		.Flags.Set(19)
	}
	if !(.LangCode == "") {
		.Flags.Set(22)
	}
	if !(.EmojiStatus == nil) {
		.Flags.Set(30)
	}
	if !(.Usernames == nil) {
		.Flags2.Set(0)
	}
	if !(.StoriesMaxID == 0) {
		.Flags2.Set(5)
	}
	if !(.Color.Zero()) {
		.Flags2.Set(8)
	}
	if !(.ProfileColor.Zero()) {
		.Flags2.Set(9)
	}
}

// Encode implements bin.Encoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode user#215c4438 as nil")
	}
	.PutID(UserTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode user#215c4438 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode user#215c4438: field flags: %w", )
	}
	if  := .Flags2.Encode();  != nil {
		return fmt.Errorf("unable to encode user#215c4438: field flags2: %w", )
	}
	.PutLong(.ID)
	if .Flags.Has(0) {
		.PutLong(.AccessHash)
	}
	if .Flags.Has(1) {
		.PutString(.FirstName)
	}
	if .Flags.Has(2) {
		.PutString(.LastName)
	}
	if .Flags.Has(3) {
		.PutString(.Username)
	}
	if .Flags.Has(4) {
		.PutString(.Phone)
	}
	if .Flags.Has(5) {
		if .Photo == nil {
			return fmt.Errorf("unable to encode user#215c4438: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode user#215c4438: field photo: %w", )
		}
	}
	if .Flags.Has(6) {
		if .Status == nil {
			return fmt.Errorf("unable to encode user#215c4438: field status is nil")
		}
		if  := .Status.Encode();  != nil {
			return fmt.Errorf("unable to encode user#215c4438: field status: %w", )
		}
	}
	if .Flags.Has(14) {
		.PutInt(.BotInfoVersion)
	}
	if .Flags.Has(18) {
		.PutVectorHeader(len(.RestrictionReason))
		for ,  := range .RestrictionReason {
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode user#215c4438: field restriction_reason element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(19) {
		.PutString(.BotInlinePlaceholder)
	}
	if .Flags.Has(22) {
		.PutString(.LangCode)
	}
	if .Flags.Has(30) {
		if .EmojiStatus == nil {
			return fmt.Errorf("unable to encode user#215c4438: field emoji_status is nil")
		}
		if  := .EmojiStatus.Encode();  != nil {
			return fmt.Errorf("unable to encode user#215c4438: field emoji_status: %w", )
		}
	}
	if .Flags2.Has(0) {
		.PutVectorHeader(len(.Usernames))
		for ,  := range .Usernames {
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode user#215c4438: field usernames element with index %d: %w", , )
			}
		}
	}
	if .Flags2.Has(5) {
		.PutInt(.StoriesMaxID)
	}
	if .Flags2.Has(8) {
		if  := .Color.Encode();  != nil {
			return fmt.Errorf("unable to encode user#215c4438: field color: %w", )
		}
	}
	if .Flags2.Has(9) {
		if  := .ProfileColor.Encode();  != nil {
			return fmt.Errorf("unable to encode user#215c4438: field profile_color: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode user#215c4438 to nil")
	}
	if  := .ConsumeID(UserTypeID);  != nil {
		return fmt.Errorf("unable to decode user#215c4438: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode user#215c4438 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field flags: %w", )
		}
	}
	.Self = .Flags.Has(10)
	.Contact = .Flags.Has(11)
	.MutualContact = .Flags.Has(12)
	.Deleted = .Flags.Has(13)
	.Bot = .Flags.Has(14)
	.BotChatHistory = .Flags.Has(15)
	.BotNochats = .Flags.Has(16)
	.Verified = .Flags.Has(17)
	.Restricted = .Flags.Has(18)
	.Min = .Flags.Has(20)
	.BotInlineGeo = .Flags.Has(21)
	.Support = .Flags.Has(23)
	.Scam = .Flags.Has(24)
	.ApplyMinPhoto = .Flags.Has(25)
	.Fake = .Flags.Has(26)
	.BotAttachMenu = .Flags.Has(27)
	.Premium = .Flags.Has(28)
	.AttachMenuEnabled = .Flags.Has(29)
	{
		if  := .Flags2.Decode();  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field flags2: %w", )
		}
	}
	.BotCanEdit = .Flags2.Has(1)
	.CloseFriend = .Flags2.Has(2)
	.StoriesHidden = .Flags2.Has(3)
	.StoriesUnavailable = .Flags2.Has(4)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field access_hash: %w", )
		}
		.AccessHash = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field first_name: %w", )
		}
		.FirstName = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field last_name: %w", )
		}
		.LastName = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field username: %w", )
		}
		.Username = 
	}
	if .Flags.Has(4) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field phone: %w", )
		}
		.Phone = 
	}
	if .Flags.Has(5) {
		,  := DecodeUserProfilePhoto()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field photo: %w", )
		}
		.Photo = 
	}
	if .Flags.Has(6) {
		,  := DecodeUserStatus()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field status: %w", )
		}
		.Status = 
	}
	if .Flags.Has(14) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field bot_info_version: %w", )
		}
		.BotInfoVersion = 
	}
	if .Flags.Has(18) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", )
		}

		if  > 0 {
			.RestrictionReason = make([]RestrictionReason, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  RestrictionReason
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", )
			}
			.RestrictionReason = append(.RestrictionReason, )
		}
	}
	if .Flags.Has(19) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field bot_inline_placeholder: %w", )
		}
		.BotInlinePlaceholder = 
	}
	if .Flags.Has(22) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field lang_code: %w", )
		}
		.LangCode = 
	}
	if .Flags.Has(30) {
		,  := DecodeEmojiStatus()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field emoji_status: %w", )
		}
		.EmojiStatus = 
	}
	if .Flags2.Has(0) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", )
		}

		if  > 0 {
			.Usernames = make([]Username, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  Username
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", )
			}
			.Usernames = append(.Usernames, )
		}
	}
	if .Flags2.Has(5) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field stories_max_id: %w", )
		}
		.StoriesMaxID = 
	}
	if .Flags2.Has(8) {
		if  := .Color.Decode();  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field color: %w", )
		}
	}
	if .Flags2.Has(9) {
		if  := .ProfileColor.Decode();  != nil {
			return fmt.Errorf("unable to decode user#215c4438: field profile_color: %w", )
		}
	}
	return nil
}

// SetSelf sets value of Self conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(10)
		.Self = true
	} else {
		.Flags.Unset(10)
		.Self = false
	}
}

// GetSelf returns value of Self conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetContact sets value of Contact conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(11)
		.Contact = true
	} else {
		.Flags.Unset(11)
		.Contact = false
	}
}

// GetContact returns value of Contact conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(11)
}

// SetMutualContact sets value of MutualContact conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(12)
		.MutualContact = true
	} else {
		.Flags.Unset(12)
		.MutualContact = false
	}
}

// GetMutualContact returns value of MutualContact conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetDeleted sets value of Deleted conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(13)
		.Deleted = true
	} else {
		.Flags.Unset(13)
		.Deleted = false
	}
}

// GetDeleted returns value of Deleted conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(13)
}

// SetBot sets value of Bot conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(14)
		.Bot = true
	} else {
		.Flags.Unset(14)
		.Bot = false
	}
}

// GetBot returns value of Bot conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(14)
}

// SetBotChatHistory sets value of BotChatHistory conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(15)
		.BotChatHistory = true
	} else {
		.Flags.Unset(15)
		.BotChatHistory = false
	}
}

// GetBotChatHistory returns value of BotChatHistory conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(15)
}

// SetBotNochats sets value of BotNochats conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(16)
		.BotNochats = true
	} else {
		.Flags.Unset(16)
		.BotNochats = false
	}
}

// GetBotNochats returns value of BotNochats conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(16)
}

// SetVerified sets value of Verified conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(17)
		.Verified = true
	} else {
		.Flags.Unset(17)
		.Verified = false
	}
}

// GetVerified returns value of Verified conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(17)
}

// SetRestricted sets value of Restricted conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(18)
		.Restricted = true
	} else {
		.Flags.Unset(18)
		.Restricted = false
	}
}

// GetRestricted returns value of Restricted conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(18)
}

// SetMin sets value of Min conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(20)
		.Min = true
	} else {
		.Flags.Unset(20)
		.Min = false
	}
}

// GetMin returns value of Min conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(20)
}

// SetBotInlineGeo sets value of BotInlineGeo conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(21)
		.BotInlineGeo = true
	} else {
		.Flags.Unset(21)
		.BotInlineGeo = false
	}
}

// GetBotInlineGeo returns value of BotInlineGeo conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(21)
}

// SetSupport sets value of Support conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(23)
		.Support = true
	} else {
		.Flags.Unset(23)
		.Support = false
	}
}

// GetSupport returns value of Support conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(23)
}

// SetScam sets value of Scam conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(24)
		.Scam = true
	} else {
		.Flags.Unset(24)
		.Scam = false
	}
}

// GetScam returns value of Scam conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(24)
}

// SetApplyMinPhoto sets value of ApplyMinPhoto conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(25)
		.ApplyMinPhoto = true
	} else {
		.Flags.Unset(25)
		.ApplyMinPhoto = false
	}
}

// GetApplyMinPhoto returns value of ApplyMinPhoto conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(25)
}

// SetFake sets value of Fake conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(26)
		.Fake = true
	} else {
		.Flags.Unset(26)
		.Fake = false
	}
}

// GetFake returns value of Fake conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(26)
}

// SetBotAttachMenu sets value of BotAttachMenu conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(27)
		.BotAttachMenu = true
	} else {
		.Flags.Unset(27)
		.BotAttachMenu = false
	}
}

// GetBotAttachMenu returns value of BotAttachMenu conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(27)
}

// SetPremium sets value of Premium conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(28)
		.Premium = true
	} else {
		.Flags.Unset(28)
		.Premium = false
	}
}

// GetPremium returns value of Premium conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(28)
}

// SetAttachMenuEnabled sets value of AttachMenuEnabled conditional field.
func ( *User) ( bool) {
	if  {
		.Flags.Set(29)
		.AttachMenuEnabled = true
	} else {
		.Flags.Unset(29)
		.AttachMenuEnabled = false
	}
}

// GetAttachMenuEnabled returns value of AttachMenuEnabled conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(29)
}

// SetBotCanEdit sets value of BotCanEdit conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(1)
		.BotCanEdit = true
	} else {
		.Flags2.Unset(1)
		.BotCanEdit = false
	}
}

// GetBotCanEdit returns value of BotCanEdit conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(1)
}

// SetCloseFriend sets value of CloseFriend conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(2)
		.CloseFriend = true
	} else {
		.Flags2.Unset(2)
		.CloseFriend = false
	}
}

// GetCloseFriend returns value of CloseFriend conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(2)
}

// SetStoriesHidden sets value of StoriesHidden conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(3)
		.StoriesHidden = true
	} else {
		.Flags2.Unset(3)
		.StoriesHidden = false
	}
}

// GetStoriesHidden returns value of StoriesHidden conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(3)
}

// SetStoriesUnavailable sets value of StoriesUnavailable conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(4)
		.StoriesUnavailable = true
	} else {
		.Flags2.Unset(4)
		.StoriesUnavailable = false
	}
}

// GetStoriesUnavailable returns value of StoriesUnavailable conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(4)
}

// GetID returns value of ID field.
func ( *User) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

// SetAccessHash sets value of AccessHash conditional field.
func ( *User) ( int64) {
	.Flags.Set(0)
	.AccessHash = 
}

// GetAccessHash returns value of AccessHash conditional field and
// boolean which is true if field was set.
func ( *User) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .AccessHash, true
}

// SetFirstName sets value of FirstName conditional field.
func ( *User) ( string) {
	.Flags.Set(1)
	.FirstName = 
}

// GetFirstName returns value of FirstName conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .FirstName, true
}

// SetLastName sets value of LastName conditional field.
func ( *User) ( string) {
	.Flags.Set(2)
	.LastName = 
}

// GetLastName returns value of LastName conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .LastName, true
}

// SetUsername sets value of Username conditional field.
func ( *User) ( string) {
	.Flags.Set(3)
	.Username = 
}

// GetUsername returns value of Username conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .Username, true
}

// SetPhone sets value of Phone conditional field.
func ( *User) ( string) {
	.Flags.Set(4)
	.Phone = 
}

// GetPhone returns value of Phone conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .Phone, true
}

// SetPhoto sets value of Photo conditional field.
func ( *User) ( UserProfilePhotoClass) {
	.Flags.Set(5)
	.Photo = 
}

// GetPhoto returns value of Photo conditional field and
// boolean which is true if field was set.
func ( *User) () ( UserProfilePhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .Photo, true
}

// SetStatus sets value of Status conditional field.
func ( *User) ( UserStatusClass) {
	.Flags.Set(6)
	.Status = 
}

// GetStatus returns value of Status conditional field and
// boolean which is true if field was set.
func ( *User) () ( UserStatusClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(6) {
		return , false
	}
	return .Status, true
}

// SetBotInfoVersion sets value of BotInfoVersion conditional field.
func ( *User) ( int) {
	.Flags.Set(14)
	.BotInfoVersion = 
}

// GetBotInfoVersion returns value of BotInfoVersion conditional field and
// boolean which is true if field was set.
func ( *User) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(14) {
		return , false
	}
	return .BotInfoVersion, true
}

// SetRestrictionReason sets value of RestrictionReason conditional field.
func ( *User) ( []RestrictionReason) {
	.Flags.Set(18)
	.RestrictionReason = 
}

// GetRestrictionReason returns value of RestrictionReason conditional field and
// boolean which is true if field was set.
func ( *User) () ( []RestrictionReason,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(18) {
		return , false
	}
	return .RestrictionReason, true
}

// SetBotInlinePlaceholder sets value of BotInlinePlaceholder conditional field.
func ( *User) ( string) {
	.Flags.Set(19)
	.BotInlinePlaceholder = 
}

// GetBotInlinePlaceholder returns value of BotInlinePlaceholder conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(19) {
		return , false
	}
	return .BotInlinePlaceholder, true
}

// SetLangCode sets value of LangCode conditional field.
func ( *User) ( string) {
	.Flags.Set(22)
	.LangCode = 
}

// GetLangCode returns value of LangCode conditional field and
// boolean which is true if field was set.
func ( *User) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(22) {
		return , false
	}
	return .LangCode, true
}

// SetEmojiStatus sets value of EmojiStatus conditional field.
func ( *User) ( EmojiStatusClass) {
	.Flags.Set(30)
	.EmojiStatus = 
}

// GetEmojiStatus returns value of EmojiStatus conditional field and
// boolean which is true if field was set.
func ( *User) () ( EmojiStatusClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(30) {
		return , false
	}
	return .EmojiStatus, true
}

// SetUsernames sets value of Usernames conditional field.
func ( *User) ( []Username) {
	.Flags2.Set(0)
	.Usernames = 
}

// GetUsernames returns value of Usernames conditional field and
// boolean which is true if field was set.
func ( *User) () ( []Username,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(0) {
		return , false
	}
	return .Usernames, true
}

// SetStoriesMaxID sets value of StoriesMaxID conditional field.
func ( *User) ( int) {
	.Flags2.Set(5)
	.StoriesMaxID = 
}

// GetStoriesMaxID returns value of StoriesMaxID conditional field and
// boolean which is true if field was set.
func ( *User) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(5) {
		return , false
	}
	return .StoriesMaxID, true
}

// SetColor sets value of Color conditional field.
func ( *User) ( PeerColor) {
	.Flags2.Set(8)
	.Color = 
}

// GetColor returns value of Color conditional field and
// boolean which is true if field was set.
func ( *User) () ( PeerColor,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(8) {
		return , false
	}
	return .Color, true
}

// SetProfileColor sets value of ProfileColor conditional field.
func ( *User) ( PeerColor) {
	.Flags2.Set(9)
	.ProfileColor = 
}

// GetProfileColor returns value of ProfileColor conditional field and
// boolean which is true if field was set.
func ( *User) () ( PeerColor,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(9) {
		return , false
	}
	return .ProfileColor, true
}

// UserClassName is schema name of UserClass.
const UserClassName = "User"

// UserClass represents User generic type.
//
// See https://core.telegram.org/type/User for reference.
//
// Example:
//
//	g, err := tg.DecodeUser(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.UserEmpty: // userEmpty#d3bc4b7a
//	case *tg.User: // user#215c4438
//	default: panic(v)
//	}
type UserClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() UserClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	// User identifier or 0
	GetID() (value int64)

	// AsNotEmpty tries to map UserClass to User.
	AsNotEmpty() (*User, bool)
}

// AsInputPeer tries to map User to InputPeerUser.
func ( *User) () *InputPeerUser {
	 := new(InputPeerUser)
	.UserID = .GetID()
	if ,  := .GetAccessHash();  {
		.AccessHash = 
	}

	return 
}

// AsInput tries to map User to InputUser.
func ( *User) () *InputUser {
	 := new(InputUser)
	.UserID = .GetID()
	if ,  := .GetAccessHash();  {
		.AccessHash = 
	}

	return 
}

// AsNotEmpty tries to map UserEmpty to User.
func ( *UserEmpty) () (*User, bool) {
	return nil, false
}

// AsNotEmpty tries to map User to User.
func ( *User) () (*User, bool) {
	return , true
}

// DecodeUser implements binary de-serialization for UserClass.
func ( *bin.Buffer) (UserClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case UserEmptyTypeID:
		// Decoding userEmpty#d3bc4b7a.
		 := UserEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserClass: %w", )
		}
		return &, nil
	case UserTypeID:
		// Decoding user#215c4438.
		 := User{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode UserClass: %w", bin.NewUnexpectedID())
	}
}

// User boxes the UserClass providing a helper.
type UserBox struct {
	User UserClass
}

// Decode implements bin.Decoder for UserBox.
func ( *UserBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode UserBox to nil")
	}
	,  := DecodeUser()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.User = 
	return nil
}

// Encode implements bin.Encode for UserBox.
func ( *UserBox) ( *bin.Buffer) error {
	if  == nil || .User == nil {
		return fmt.Errorf("unable to encode UserClass as nil")
	}
	return .User.Encode()
}