// 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#31774388`.
// Indicates info about a certain user.
// Unless specified otherwise, when updating the local peer database¹, all fields from
// the newly received constructor take priority over the old constructor cached locally
// (including by removing fields that aren't set in the new constructor).
// See here »¹ for an implementation of the logic to use when updating the local user
// peer database².
//
// Links:
//  1. https://core.telegram.org/api/peers
//  2. https://github.com/tdlib/td/blob/cb164927417f22811c74cd8678ed4a5ab7cb80ba/td/telegram/UserManager.cpp#L2267
//  3. https://core.telegram.org/api/peers
//
// 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 When updating the local peer database¹, do not apply
	// changes to this field if the min flag is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	Contact bool
	// Whether this user is a mutual contact. When updating the local peer database¹, do not
	// apply changes to this field if the min flag is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	MutualContact bool
	// Whether the account of this user was deleted. Changes to this flag should invalidate
	// the local userFull¹ cache for this user ID, see here »² for more info.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/userFull
	//  2) https://core.telegram.org/api/peers#full-info-database
	Deleted bool
	// Is this user a bot? Changes to this flag should invalidate the local userFull¹ cache
	// for this user ID, see here »² for more info.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/userFull
	//  2) https://core.telegram.org/api/peers#full-info-database
	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 and min is set, the value of photo can be used to update the local database,
	// see the documentation of that flag for more info.
	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 Changes to this flag should invalidate
	// the local userFull¹ cache for this user ID, see here »² for more info. Changes to
	// this flag if the self flag is set should also trigger the following calls, to refresh
	// the respective caches: - The help.getConfig³ cache - The messages.getTopReactions⁴
	// cache if the bot flag is not set
	//
	// Links:
	//  1) https://core.telegram.org/constructor/userFull
	//  2) https://core.telegram.org/api/peers#full-info-database
	//  3) https://core.telegram.org/method/help.getConfig
	//  4) https://core.telegram.org/method/messages.getTopReactions
	Premium bool
	// Whether we installed the attachment menu web app¹ offered by this bot. When updating
	// the local peer database², do not apply changes to this field if the min flag is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/attach
	//  2) https://core.telegram.org/api/peers
	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. When updating the local peer database¹, do not apply changes to
	// this field if the min flag is set. Changes to this flag (if min is not set) should
	// invalidate the local userFull² cache for this user ID.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//  2) https://core.telegram.org/constructor/userFull
	BotCanEdit bool
	// Whether we marked this user as a close friend, see here » for more info¹. When
	// updating the local peer database², do not apply changes to this field if the min flag
	// is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/privacy
	//  2) https://core.telegram.org/api/peers
	CloseFriend bool
	// Whether we have hidden »¹ all active stories of this user. When updating the local
	// peer database², do not apply changes to this field if the min flag is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/stories#hiding-stories-of-other-users
	//  2) https://core.telegram.org/api/peers
	StoriesHidden bool
	// No stories from this user are visible.
	StoriesUnavailable bool
	// See here for more info on this flag »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/privacy#require-premium-for-new-non-contact-users
	ContactRequirePremium bool
	// Whether this bot can be connected to a user as specified here »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/connected-business-bots
	BotBusiness bool
	// If set, this bot has configured a Main Mini App »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps#main-mini-apps
	BotHasMainApp bool
	// If set, this bot supports bot forum topics »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#bot-forums
	BotForumView bool
	// If set, this bot supports bot forum topics »¹, and users (not just the bot!) are
	// allowed to create and manage bot forum topics in their private chat with the bot.
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#bot-forums
	BotForumCanManageTopics bool
	// BotCanManageBots field of User.
	BotCanManageBots bool
	// BotGuestchat field of User.
	BotGuestchat bool
	// BotGuard field of User.
	BotGuard bool
	// ID of the user, see here »¹ for more info and the available ID range.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers#peer-id
	ID int64
	// Access hash of the user, see here »¹ for more info. If this flag is set, when
	// updating the local peer database², generate a virtual flag called min_access_hash,
	// which is: - Set to true if min is set AND -- The phone flag is not set OR -- The phone
	// flag is set and the associated phone number string is non-empty - Set to false
	// otherwise. Then, apply both access_hash and min_access_hash to the local database if:
	// - min_access_hash is false OR - min_access_hash is true AND -- There is no locally
	// cached object for this user OR -- There is no access_hash in the local cache OR -- The
	// cached object's min_access_hash is also true If the final merged object stored to the
	// database has the min_access_hash field set to true, the related access_hash is only
	// suitable to use in inputPeerPhotoFileLocation »³, to directly download the profile
	// pictures⁴ of users, everywhere else a inputPeer*FromMessage constructor will have to
	// be generated as specified here »⁵. Bots can also use min access hashes in some
	// conditions, by passing 0 instead of the min access hash.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers#access-hash
	//  2) https://core.telegram.org/api/peers
	//  3) https://core.telegram.org/constructor/inputPeerPhotoFileLocation
	//  4) https://core.telegram.org/api/files
	//  5) https://core.telegram.org/api/min
	//
	// Use SetAccessHash and GetAccessHash helpers.
	AccessHash int64
	// First name. When updating the local peer database¹, apply changes to this field only
	// if: - The min flag is not set OR - The min flag is set AND -- The min flag of the
	// locally cached user entry is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//
	// Use SetFirstName and GetFirstName helpers.
	FirstName string
	// Last name. When updating the local peer database¹, apply changes to this field only
	// if: - The min flag is not set OR - The min flag is set AND -- The min flag of the
	// locally cached user entry is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//
	// Use SetLastName and GetLastName helpers.
	LastName string
	// Main active username. When updating the local peer database¹, apply changes to this
	// field only if: - The min flag is not set OR - The min flag is set AND -- The min flag
	// of the locally cached user entry is set. Changes to this flag should invalidate the
	// local userFull² cache for this user ID if the above conditions are respected and the
	// bot_can_edit flag is also set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//  2) https://core.telegram.org/constructor/userFull
	//
	// Use SetUsername and GetUsername helpers.
	Username string
	// Phone number. When updating the local peer database¹, apply changes to this field
	// only if: - The min flag is not set OR - The min flag is set AND -- The min flag of the
	// locally cached user entry is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//
	// Use SetPhone and GetPhone helpers.
	Phone string
	// Profile picture of user. When updating the local peer database¹, apply changes to
	// this field only if: - The min flag is not set OR - The min flag is set AND -- The
	// apply_min_photo flag is set OR -- The min flag of the locally cached user entry is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo UserProfilePhotoClass
	// Online status of user. When updating the local peer database¹, apply changes to this
	// field only if: - The min flag is not set OR - The min flag is set AND -- The min flag
	// of the locally cached user entry is set OR -- The locally cached user entry is equal
	// to userStatusEmpty².
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//  2) https://core.telegram.org/constructor/userStatusEmpty
	//
	// Use SetStatus and GetStatus helpers.
	Status UserStatusClass
	// Version of the bot_info field in userFull¹, incremented every time it changes.
	// Changes to this flag should invalidate the local userFull² cache for this user ID,
	// see here »³ for more info.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/userFull
	//  2) https://core.telegram.org/constructor/userFull
	//  3) https://core.telegram.org/api/peers#full-info-database
	//
	// 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. When updating the local peer database¹, apply changes to this
	// field only if: - The min flag is not set OR - The min flag is set AND -- The min flag
	// of the locally cached user entry is set. Changes to this flag (if the above conditions
	// are respected) should invalidate the local userFull² cache for this user ID.
	//
	// Links:
	//  1) https://core.telegram.org/api/peers
	//  2) https://core.telegram.org/constructor/userFull
	//
	// Use SetUsernames and GetUsernames helpers.
	Usernames []Username
	// ID of the maximum read story¹.  When updating the local peer database², do not apply
	// changes to this field if the min flag of the incoming constructor is set.
	//
	// Links:
	//  1) https://core.telegram.org/api/stories
	//  2) https://core.telegram.org/api/peers
	//
	// Use SetStoriesMaxID and GetStoriesMaxID helpers.
	StoriesMaxID RecentStory
	// The user's accent color¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	//
	// Use SetColor and GetColor helpers.
	Color PeerColorClass
	// The user's profile color¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	//
	// Use SetProfileColor and GetProfileColor helpers.
	ProfileColor PeerColorClass
	// Monthly Active Users (MAU) of this bot (may be absent for small bots).
	//
	// Use SetBotActiveUsers and GetBotActiveUsers helpers.
	BotActiveUsers int
	// Describes a bot verification icon »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/verification
	//
	// Use SetBotVerificationIcon and GetBotVerificationIcon helpers.
	BotVerificationIcon int64
	// If set, the user has enabled paid messages »¹, we might need to pay the specified
	// amount of Stars² to send them messages, depending on the configured exceptions: check
	// userFull³.send_paid_messages_stars or users.getRequirementsToContact⁴ to see if the
	// currently logged in user actually has to pay or not, see here »⁵ for the full flow.
	//
	// Links:
	//  1) https://core.telegram.org/api/paid-messages
	//  2) https://core.telegram.org/api/stars
	//  3) https://core.telegram.org/constructor/userFull
	//  4) https://core.telegram.org/method/users.getRequirementsToContact
	//  5) https://core.telegram.org/api/paid-messages
	//
	// Use SetSendPaidMessagesStars and GetSendPaidMessagesStars helpers.
	SendPaidMessagesStars int64
}

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

// 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 !(.ContactRequirePremium == false) {
		return false
	}
	if !(.BotBusiness == false) {
		return false
	}
	if !(.BotHasMainApp == false) {
		return false
	}
	if !(.BotForumView == false) {
		return false
	}
	if !(.BotForumCanManageTopics == false) {
		return false
	}
	if !(.BotCanManageBots == false) {
		return false
	}
	if !(.BotGuestchat == false) {
		return false
	}
	if !(.BotGuard == 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.Zero()) {
		return false
	}
	if !(.Color == nil) {
		return false
	}
	if !(.ProfileColor == nil) {
		return false
	}
	if !(.BotActiveUsers == 0) {
		return false
	}
	if !(.BotVerificationIcon == 0) {
		return false
	}
	if !(.SendPaidMessagesStars == 0) {
		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)
	() ( 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)
	() ( RecentStory,  bool)
	() ( PeerColorClass,  bool)
	() ( PeerColorClass,  bool)
	() ( int,  bool)
	() ( int64,  bool)
	() ( int64,  bool)
}) {
	.Self = .()
	.Contact = .()
	.MutualContact = .()
	.Deleted = .()
	.Bot = .()
	.BotChatHistory = .()
	.BotNochats = .()
	.Verified = .()
	.Restricted = .()
	.Min = .()
	.BotInlineGeo = .()
	.Support = .()
	.Scam = .()
	.ApplyMinPhoto = .()
	.Fake = .()
	.BotAttachMenu = .()
	.Premium = .()
	.AttachMenuEnabled = .()
	.BotCanEdit = .()
	.CloseFriend = .()
	.StoriesHidden = .()
	.StoriesUnavailable = .()
	.ContactRequirePremium = .()
	.BotBusiness = .()
	.BotHasMainApp = .()
	.BotForumView = .()
	.BotForumCanManageTopics = .()
	.BotCanManageBots = .()
	.BotGuestchat = .()
	.BotGuard = .()
	.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 = 
	}

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

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

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

}

// 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:       "ContactRequirePremium",
			SchemaName: "contact_require_premium",
			Null:       !.Flags2.Has(10),
		},
		{
			Name:       "BotBusiness",
			SchemaName: "bot_business",
			Null:       !.Flags2.Has(11),
		},
		{
			Name:       "BotHasMainApp",
			SchemaName: "bot_has_main_app",
			Null:       !.Flags2.Has(13),
		},
		{
			Name:       "BotForumView",
			SchemaName: "bot_forum_view",
			Null:       !.Flags2.Has(16),
		},
		{
			Name:       "BotForumCanManageTopics",
			SchemaName: "bot_forum_can_manage_topics",
			Null:       !.Flags2.Has(17),
		},
		{
			Name:       "BotCanManageBots",
			SchemaName: "bot_can_manage_bots",
			Null:       !.Flags2.Has(18),
		},
		{
			Name:       "BotGuestchat",
			SchemaName: "bot_guestchat",
			Null:       !.Flags2.Has(19),
		},
		{
			Name:       "BotGuard",
			SchemaName: "bot_guard",
			Null:       !.Flags2.Has(20),
		},
		{
			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),
		},
		{
			Name:       "BotActiveUsers",
			SchemaName: "bot_active_users",
			Null:       !.Flags2.Has(12),
		},
		{
			Name:       "BotVerificationIcon",
			SchemaName: "bot_verification_icon",
			Null:       !.Flags2.Has(14),
		},
		{
			Name:       "SendPaidMessagesStars",
			SchemaName: "send_paid_messages_stars",
			Null:       !.Flags2.Has(15),
		},
	}
	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 !(.ContactRequirePremium == false) {
		.Flags2.Set(10)
	}
	if !(.BotBusiness == false) {
		.Flags2.Set(11)
	}
	if !(.BotHasMainApp == false) {
		.Flags2.Set(13)
	}
	if !(.BotForumView == false) {
		.Flags2.Set(16)
	}
	if !(.BotForumCanManageTopics == false) {
		.Flags2.Set(17)
	}
	if !(.BotCanManageBots == false) {
		.Flags2.Set(18)
	}
	if !(.BotGuestchat == false) {
		.Flags2.Set(19)
	}
	if !(.BotGuard == false) {
		.Flags2.Set(20)
	}
	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.Zero()) {
		.Flags2.Set(5)
	}
	if !(.Color == nil) {
		.Flags2.Set(8)
	}
	if !(.ProfileColor == nil) {
		.Flags2.Set(9)
	}
	if !(.BotActiveUsers == 0) {
		.Flags2.Set(12)
	}
	if !(.BotVerificationIcon == 0) {
		.Flags2.Set(14)
	}
	if !(.SendPaidMessagesStars == 0) {
		.Flags2.Set(15)
	}
}

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

// EncodeBare implements bin.BareEncoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode user#31774388 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode user#31774388: field flags: %w", )
	}
	if  := .Flags2.Encode();  != nil {
		return fmt.Errorf("unable to encode user#31774388: 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#31774388: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: field photo: %w", )
		}
	}
	if .Flags.Has(6) {
		if .Status == nil {
			return fmt.Errorf("unable to encode user#31774388: field status is nil")
		}
		if  := .Status.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: 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#31774388: 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#31774388: field emoji_status is nil")
		}
		if  := .EmojiStatus.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: field emoji_status: %w", )
		}
	}
	if .Flags2.Has(0) {
		.PutVectorHeader(len(.Usernames))
		for ,  := range .Usernames {
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode user#31774388: field usernames element with index %d: %w", , )
			}
		}
	}
	if .Flags2.Has(5) {
		if  := .StoriesMaxID.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: field stories_max_id: %w", )
		}
	}
	if .Flags2.Has(8) {
		if .Color == nil {
			return fmt.Errorf("unable to encode user#31774388: field color is nil")
		}
		if  := .Color.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: field color: %w", )
		}
	}
	if .Flags2.Has(9) {
		if .ProfileColor == nil {
			return fmt.Errorf("unable to encode user#31774388: field profile_color is nil")
		}
		if  := .ProfileColor.Encode();  != nil {
			return fmt.Errorf("unable to encode user#31774388: field profile_color: %w", )
		}
	}
	if .Flags2.Has(12) {
		.PutInt(.BotActiveUsers)
	}
	if .Flags2.Has(14) {
		.PutLong(.BotVerificationIcon)
	}
	if .Flags2.Has(15) {
		.PutLong(.SendPaidMessagesStars)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *User) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode user#31774388 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode user#31774388: 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#31774388: field flags2: %w", )
		}
	}
	.BotCanEdit = .Flags2.Has(1)
	.CloseFriend = .Flags2.Has(2)
	.StoriesHidden = .Flags2.Has(3)
	.StoriesUnavailable = .Flags2.Has(4)
	.ContactRequirePremium = .Flags2.Has(10)
	.BotBusiness = .Flags2.Has(11)
	.BotHasMainApp = .Flags2.Has(13)
	.BotForumView = .Flags2.Has(16)
	.BotForumCanManageTopics = .Flags2.Has(17)
	.BotCanManageBots = .Flags2.Has(18)
	.BotGuestchat = .Flags2.Has(19)
	.BotGuard = .Flags2.Has(20)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field access_hash: %w", )
		}
		.AccessHash = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field first_name: %w", )
		}
		.FirstName = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field last_name: %w", )
		}
		.LastName = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field username: %w", )
		}
		.Username = 
	}
	if .Flags.Has(4) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field phone: %w", )
		}
		.Phone = 
	}
	if .Flags.Has(5) {
		,  := DecodeUserProfilePhoto()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field photo: %w", )
		}
		.Photo = 
	}
	if .Flags.Has(6) {
		,  := DecodeUserStatus()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field status: %w", )
		}
		.Status = 
	}
	if .Flags.Has(14) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field bot_info_version: %w", )
		}
		.BotInfoVersion = 
	}
	if .Flags.Has(18) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: 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#31774388: field restriction_reason: %w", )
			}
			.RestrictionReason = append(.RestrictionReason, )
		}
	}
	if .Flags.Has(19) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field bot_inline_placeholder: %w", )
		}
		.BotInlinePlaceholder = 
	}
	if .Flags.Has(22) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field lang_code: %w", )
		}
		.LangCode = 
	}
	if .Flags.Has(30) {
		,  := DecodeEmojiStatus()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field emoji_status: %w", )
		}
		.EmojiStatus = 
	}
	if .Flags2.Has(0) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: 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#31774388: field usernames: %w", )
			}
			.Usernames = append(.Usernames, )
		}
	}
	if .Flags2.Has(5) {
		if  := .StoriesMaxID.Decode();  != nil {
			return fmt.Errorf("unable to decode user#31774388: field stories_max_id: %w", )
		}
	}
	if .Flags2.Has(8) {
		,  := DecodePeerColor()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field color: %w", )
		}
		.Color = 
	}
	if .Flags2.Has(9) {
		,  := DecodePeerColor()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field profile_color: %w", )
		}
		.ProfileColor = 
	}
	if .Flags2.Has(12) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field bot_active_users: %w", )
		}
		.BotActiveUsers = 
	}
	if .Flags2.Has(14) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field bot_verification_icon: %w", )
		}
		.BotVerificationIcon = 
	}
	if .Flags2.Has(15) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode user#31774388: field send_paid_messages_stars: %w", )
		}
		.SendPaidMessagesStars = 
	}
	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)
}

// SetContactRequirePremium sets value of ContactRequirePremium conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(10)
		.ContactRequirePremium = true
	} else {
		.Flags2.Unset(10)
		.ContactRequirePremium = false
	}
}

// GetContactRequirePremium returns value of ContactRequirePremium conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(10)
}

// SetBotBusiness sets value of BotBusiness conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(11)
		.BotBusiness = true
	} else {
		.Flags2.Unset(11)
		.BotBusiness = false
	}
}

// GetBotBusiness returns value of BotBusiness conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(11)
}

// SetBotHasMainApp sets value of BotHasMainApp conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(13)
		.BotHasMainApp = true
	} else {
		.Flags2.Unset(13)
		.BotHasMainApp = false
	}
}

// GetBotHasMainApp returns value of BotHasMainApp conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(13)
}

// SetBotForumView sets value of BotForumView conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(16)
		.BotForumView = true
	} else {
		.Flags2.Unset(16)
		.BotForumView = false
	}
}

// GetBotForumView returns value of BotForumView conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(16)
}

// SetBotForumCanManageTopics sets value of BotForumCanManageTopics conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(17)
		.BotForumCanManageTopics = true
	} else {
		.Flags2.Unset(17)
		.BotForumCanManageTopics = false
	}
}

// GetBotForumCanManageTopics returns value of BotForumCanManageTopics conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(17)
}

// SetBotCanManageBots sets value of BotCanManageBots conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(18)
		.BotCanManageBots = true
	} else {
		.Flags2.Unset(18)
		.BotCanManageBots = false
	}
}

// GetBotCanManageBots returns value of BotCanManageBots conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(18)
}

// SetBotGuestchat sets value of BotGuestchat conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(19)
		.BotGuestchat = true
	} else {
		.Flags2.Unset(19)
		.BotGuestchat = false
	}
}

// GetBotGuestchat returns value of BotGuestchat conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(19)
}

// SetBotGuard sets value of BotGuard conditional field.
func ( *User) ( bool) {
	if  {
		.Flags2.Set(20)
		.BotGuard = true
	} else {
		.Flags2.Unset(20)
		.BotGuard = false
	}
}

// GetBotGuard returns value of BotGuard conditional field.
func ( *User) () ( bool) {
	if  == nil {
		return
	}
	return .Flags2.Has(20)
}

// 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) ( RecentStory) {
	.Flags2.Set(5)
	.StoriesMaxID = 
}

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

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

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

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

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

// SetBotActiveUsers sets value of BotActiveUsers conditional field.
func ( *User) ( int) {
	.Flags2.Set(12)
	.BotActiveUsers = 
}

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

// SetBotVerificationIcon sets value of BotVerificationIcon conditional field.
func ( *User) ( int64) {
	.Flags2.Set(14)
	.BotVerificationIcon = 
}

// GetBotVerificationIcon returns value of BotVerificationIcon conditional field and
// boolean which is true if field was set.
func ( *User) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(14) {
		return , false
	}
	return .BotVerificationIcon, true
}

// SetSendPaidMessagesStars sets value of SendPaidMessagesStars conditional field.
func ( *User) ( int64) {
	.Flags2.Set(15)
	.SendPaidMessagesStars = 
}

// GetSendPaidMessagesStars returns value of SendPaidMessagesStars conditional field and
// boolean which is true if field was set.
func ( *User) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags2.Has(15) {
		return , false
	}
	return .SendPaidMessagesStars, true
}

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

// UserClass represents User generic type.
//
// See https://core.telegram.org/type/User for reference.
//
// Constructors:
//   - [UserEmpty]
//   - [User]
//
// Example:
//
//	g, err := tg.DecodeUser(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.UserEmpty: // userEmpty#d3bc4b7a
//	case *tg.User: // user#31774388
//	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 
}

// AsInputCollectibleUsername tries to map User to InputCollectibleUsername.
func ( *User) () *InputCollectibleUsername {
	 := new(InputCollectibleUsername)
	if ,  := .GetUsername();  {
		.Username = 
	}

	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#31774388.
		 := 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()
}