// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"github.com/gotd/td/bin"
	"github.com/gotd/td/tdjson"
	"github.com/gotd/td/tdp"
	"github.com/gotd/td/tgerr"
)

// 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{}
)

// ChatFull represents TL type `chatFull#c9d31138`.
// Full info about a basic group¹.
//
// Links:
//  1. https://core.telegram.org/api/channel#basic-groups
//
// See https://core.telegram.org/constructor/chatFull for reference.
type ChatFull struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Can we change the username of this chat
	CanSetUsername bool
	// Whether scheduled messages¹ are available
	//
	// Links:
	//  1) https://core.telegram.org/api/scheduled-messages
	HasScheduled bool
	// Whether the real-time chat translation popup¹ should be hidden.
	//
	// Links:
	//  1) https://core.telegram.org/api/translation
	TranslationsDisabled bool
	// ID of the chat
	ID int64
	// About string for this chat
	About string
	// Participant list
	Participants ChatParticipantsClass
	// Chat photo
	//
	// Use SetChatPhoto and GetChatPhoto helpers.
	ChatPhoto PhotoClass
	// Notification settings
	NotifySettings PeerNotifySettings
	// Chat invite
	//
	// Use SetExportedInvite and GetExportedInvite helpers.
	ExportedInvite ExportedChatInviteClass
	// Info about bots that are in this chat
	//
	// Use SetBotInfo and GetBotInfo helpers.
	BotInfo []BotInfo
	// Message ID of the last pinned message¹
	//
	// Links:
	//  1) https://core.telegram.org/api/pin
	//
	// Use SetPinnedMsgID and GetPinnedMsgID helpers.
	PinnedMsgID int
	// Peer folder ID, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/folders#peer-folders
	//
	// Use SetFolderID and GetFolderID helpers.
	FolderID int
	// Group call information
	//
	// Use SetCall and GetCall helpers.
	Call InputGroupCall
	// Time-To-Live of messages sent by the current user to this chat
	//
	// Use SetTTLPeriod and GetTTLPeriod helpers.
	TTLPeriod int
	// When using phone.getGroupCallJoinAs¹ to get a list of peers that can be used to join
	// a group call, this field indicates the peer that should be selected by default.
	//
	// Links:
	//  1) https://core.telegram.org/method/phone.getGroupCallJoinAs
	//
	// Use SetGroupcallDefaultJoinAs and GetGroupcallDefaultJoinAs helpers.
	GroupcallDefaultJoinAs PeerClass
	// Emoji representing a specific chat theme
	//
	// Use SetThemeEmoticon and GetThemeEmoticon helpers.
	ThemeEmoticon string
	// Pending join requests »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	//
	// Use SetRequestsPending and GetRequestsPending helpers.
	RequestsPending int
	// IDs of users who requested to join recently
	//
	// Use SetRecentRequesters and GetRecentRequesters helpers.
	RecentRequesters []int64
	// Allowed message reactions »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/reactions
	//
	// Use SetAvailableReactions and GetAvailableReactions helpers.
	AvailableReactions ChatReactionsClass
}

// ChatFullTypeID is TL type id of ChatFull.
const ChatFullTypeID = 0xc9d31138

// construct implements constructor of ChatFullClass.
func (c ChatFull) construct() ChatFullClass { return &c }

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

	_ ChatFullClass = &ChatFull{}
)

func (c *ChatFull) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Flags.Zero()) {
		return false
	}
	if !(c.CanSetUsername == false) {
		return false
	}
	if !(c.HasScheduled == false) {
		return false
	}
	if !(c.TranslationsDisabled == false) {
		return false
	}
	if !(c.ID == 0) {
		return false
	}
	if !(c.About == "") {
		return false
	}
	if !(c.Participants == nil) {
		return false
	}
	if !(c.ChatPhoto == nil) {
		return false
	}
	if !(c.NotifySettings.Zero()) {
		return false
	}
	if !(c.ExportedInvite == nil) {
		return false
	}
	if !(c.BotInfo == nil) {
		return false
	}
	if !(c.PinnedMsgID == 0) {
		return false
	}
	if !(c.FolderID == 0) {
		return false
	}
	if !(c.Call.Zero()) {
		return false
	}
	if !(c.TTLPeriod == 0) {
		return false
	}
	if !(c.GroupcallDefaultJoinAs == nil) {
		return false
	}
	if !(c.ThemeEmoticon == "") {
		return false
	}
	if !(c.RequestsPending == 0) {
		return false
	}
	if !(c.RecentRequesters == nil) {
		return false
	}
	if !(c.AvailableReactions == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ChatFull from given interface.
func (c *ChatFull) FillFrom(from interface {
	GetCanSetUsername() (value bool)
	GetHasScheduled() (value bool)
	GetTranslationsDisabled() (value bool)
	GetID() (value int64)
	GetAbout() (value string)
	GetParticipants() (value ChatParticipantsClass)
	GetChatPhoto() (value PhotoClass, ok bool)
	GetNotifySettings() (value PeerNotifySettings)
	GetExportedInvite() (value ExportedChatInviteClass, ok bool)
	GetBotInfo() (value []BotInfo, ok bool)
	GetPinnedMsgID() (value int, ok bool)
	GetFolderID() (value int, ok bool)
	GetCall() (value InputGroupCall, ok bool)
	GetTTLPeriod() (value int, ok bool)
	GetGroupcallDefaultJoinAs() (value PeerClass, ok bool)
	GetThemeEmoticon() (value string, ok bool)
	GetRequestsPending() (value int, ok bool)
	GetRecentRequesters() (value []int64, ok bool)
	GetAvailableReactions() (value ChatReactionsClass, ok bool)
}) {
	c.CanSetUsername = from.GetCanSetUsername()
	c.HasScheduled = from.GetHasScheduled()
	c.TranslationsDisabled = from.GetTranslationsDisabled()
	c.ID = from.GetID()
	c.About = from.GetAbout()
	c.Participants = from.GetParticipants()
	if val, ok := from.GetChatPhoto(); ok {
		c.ChatPhoto = val
	}

	c.NotifySettings = from.GetNotifySettings()
	if val, ok := from.GetExportedInvite(); ok {
		c.ExportedInvite = val
	}

	if val, ok := from.GetBotInfo(); ok {
		c.BotInfo = val
	}

	if val, ok := from.GetPinnedMsgID(); ok {
		c.PinnedMsgID = val
	}

	if val, ok := from.GetFolderID(); ok {
		c.FolderID = val
	}

	if val, ok := from.GetCall(); ok {
		c.Call = val
	}

	if val, ok := from.GetTTLPeriod(); ok {
		c.TTLPeriod = val
	}

	if val, ok := from.GetGroupcallDefaultJoinAs(); ok {
		c.GroupcallDefaultJoinAs = val
	}

	if val, ok := from.GetThemeEmoticon(); ok {
		c.ThemeEmoticon = val
	}

	if val, ok := from.GetRequestsPending(); ok {
		c.RequestsPending = val
	}

	if val, ok := from.GetRecentRequesters(); ok {
		c.RecentRequesters = val
	}

	if val, ok := from.GetAvailableReactions(); ok {
		c.AvailableReactions = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (c *ChatFull) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatFull",
		ID:   ChatFullTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "CanSetUsername",
			SchemaName: "can_set_username",
			Null:       !c.Flags.Has(7),
		},
		{
			Name:       "HasScheduled",
			SchemaName: "has_scheduled",
			Null:       !c.Flags.Has(8),
		},
		{
			Name:       "TranslationsDisabled",
			SchemaName: "translations_disabled",
			Null:       !c.Flags.Has(19),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "About",
			SchemaName: "about",
		},
		{
			Name:       "Participants",
			SchemaName: "participants",
		},
		{
			Name:       "ChatPhoto",
			SchemaName: "chat_photo",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "NotifySettings",
			SchemaName: "notify_settings",
		},
		{
			Name:       "ExportedInvite",
			SchemaName: "exported_invite",
			Null:       !c.Flags.Has(13),
		},
		{
			Name:       "BotInfo",
			SchemaName: "bot_info",
			Null:       !c.Flags.Has(3),
		},
		{
			Name:       "PinnedMsgID",
			SchemaName: "pinned_msg_id",
			Null:       !c.Flags.Has(6),
		},
		{
			Name:       "FolderID",
			SchemaName: "folder_id",
			Null:       !c.Flags.Has(11),
		},
		{
			Name:       "Call",
			SchemaName: "call",
			Null:       !c.Flags.Has(12),
		},
		{
			Name:       "TTLPeriod",
			SchemaName: "ttl_period",
			Null:       !c.Flags.Has(14),
		},
		{
			Name:       "GroupcallDefaultJoinAs",
			SchemaName: "groupcall_default_join_as",
			Null:       !c.Flags.Has(15),
		},
		{
			Name:       "ThemeEmoticon",
			SchemaName: "theme_emoticon",
			Null:       !c.Flags.Has(16),
		},
		{
			Name:       "RequestsPending",
			SchemaName: "requests_pending",
			Null:       !c.Flags.Has(17),
		},
		{
			Name:       "RecentRequesters",
			SchemaName: "recent_requesters",
			Null:       !c.Flags.Has(17),
		},
		{
			Name:       "AvailableReactions",
			SchemaName: "available_reactions",
			Null:       !c.Flags.Has(18),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (c *ChatFull) SetFlags() {
	if !(c.CanSetUsername == false) {
		c.Flags.Set(7)
	}
	if !(c.HasScheduled == false) {
		c.Flags.Set(8)
	}
	if !(c.TranslationsDisabled == false) {
		c.Flags.Set(19)
	}
	if !(c.ChatPhoto == nil) {
		c.Flags.Set(2)
	}
	if !(c.ExportedInvite == nil) {
		c.Flags.Set(13)
	}
	if !(c.BotInfo == nil) {
		c.Flags.Set(3)
	}
	if !(c.PinnedMsgID == 0) {
		c.Flags.Set(6)
	}
	if !(c.FolderID == 0) {
		c.Flags.Set(11)
	}
	if !(c.Call.Zero()) {
		c.Flags.Set(12)
	}
	if !(c.TTLPeriod == 0) {
		c.Flags.Set(14)
	}
	if !(c.GroupcallDefaultJoinAs == nil) {
		c.Flags.Set(15)
	}
	if !(c.ThemeEmoticon == "") {
		c.Flags.Set(16)
	}
	if !(c.RequestsPending == 0) {
		c.Flags.Set(17)
	}
	if !(c.RecentRequesters == nil) {
		c.Flags.Set(17)
	}
	if !(c.AvailableReactions == nil) {
		c.Flags.Set(18)
	}
}

// Encode implements bin.Encoder.
func (c *ChatFull) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatFull#c9d31138 as nil")
	}
	b.PutID(ChatFullTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatFull) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatFull#c9d31138 as nil")
	}
	c.SetFlags()
	if err := c.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatFull#c9d31138: field flags: %w", err)
	}
	b.PutLong(c.ID)
	b.PutString(c.About)
	if c.Participants == nil {
		return fmt.Errorf("unable to encode chatFull#c9d31138: field participants is nil")
	}
	if err := c.Participants.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatFull#c9d31138: field participants: %w", err)
	}
	if c.Flags.Has(2) {
		if c.ChatPhoto == nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field chat_photo is nil")
		}
		if err := c.ChatPhoto.Encode(b); err != nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field chat_photo: %w", err)
		}
	}
	if err := c.NotifySettings.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatFull#c9d31138: field notify_settings: %w", err)
	}
	if c.Flags.Has(13) {
		if c.ExportedInvite == nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field exported_invite is nil")
		}
		if err := c.ExportedInvite.Encode(b); err != nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field exported_invite: %w", err)
		}
	}
	if c.Flags.Has(3) {
		b.PutVectorHeader(len(c.BotInfo))
		for idx, v := range c.BotInfo {
			if err := v.Encode(b); err != nil {
				return fmt.Errorf("unable to encode chatFull#c9d31138: field bot_info element with index %d: %w", idx, err)
			}
		}
	}
	if c.Flags.Has(6) {
		b.PutInt(c.PinnedMsgID)
	}
	if c.Flags.Has(11) {
		b.PutInt(c.FolderID)
	}
	if c.Flags.Has(12) {
		if err := c.Call.Encode(b); err != nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field call: %w", err)
		}
	}
	if c.Flags.Has(14) {
		b.PutInt(c.TTLPeriod)
	}
	if c.Flags.Has(15) {
		if c.GroupcallDefaultJoinAs == nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field groupcall_default_join_as is nil")
		}
		if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field groupcall_default_join_as: %w", err)
		}
	}
	if c.Flags.Has(16) {
		b.PutString(c.ThemeEmoticon)
	}
	if c.Flags.Has(17) {
		b.PutInt(c.RequestsPending)
	}
	if c.Flags.Has(17) {
		b.PutVectorHeader(len(c.RecentRequesters))
		for _, v := range c.RecentRequesters {
			b.PutLong(v)
		}
	}
	if c.Flags.Has(18) {
		if c.AvailableReactions == nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field available_reactions is nil")
		}
		if err := c.AvailableReactions.Encode(b); err != nil {
			return fmt.Errorf("unable to encode chatFull#c9d31138: field available_reactions: %w", err)
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatFull) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatFull#c9d31138 to nil")
	}
	if err := b.ConsumeID(ChatFullTypeID); err != nil {
		return fmt.Errorf("unable to decode chatFull#c9d31138: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatFull) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatFull#c9d31138 to nil")
	}
	{
		if err := c.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field flags: %w", err)
		}
	}
	c.CanSetUsername = c.Flags.Has(7)
	c.HasScheduled = c.Flags.Has(8)
	c.TranslationsDisabled = c.Flags.Has(19)
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field id: %w", err)
		}
		c.ID = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field about: %w", err)
		}
		c.About = value
	}
	{
		value, err := DecodeChatParticipants(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field participants: %w", err)
		}
		c.Participants = value
	}
	if c.Flags.Has(2) {
		value, err := DecodePhoto(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field chat_photo: %w", err)
		}
		c.ChatPhoto = value
	}
	{
		if err := c.NotifySettings.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field notify_settings: %w", err)
		}
	}
	if c.Flags.Has(13) {
		value, err := DecodeExportedChatInvite(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field exported_invite: %w", err)
		}
		c.ExportedInvite = value
	}
	if c.Flags.Has(3) {
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field bot_info: %w", err)
		}

		if headerLen > 0 {
			c.BotInfo = make([]BotInfo, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			var value BotInfo
			if err := value.Decode(b); err != nil {
				return fmt.Errorf("unable to decode chatFull#c9d31138: field bot_info: %w", err)
			}
			c.BotInfo = append(c.BotInfo, value)
		}
	}
	if c.Flags.Has(6) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field pinned_msg_id: %w", err)
		}
		c.PinnedMsgID = value
	}
	if c.Flags.Has(11) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field folder_id: %w", err)
		}
		c.FolderID = value
	}
	if c.Flags.Has(12) {
		if err := c.Call.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field call: %w", err)
		}
	}
	if c.Flags.Has(14) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field ttl_period: %w", err)
		}
		c.TTLPeriod = value
	}
	if c.Flags.Has(15) {
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field groupcall_default_join_as: %w", err)
		}
		c.GroupcallDefaultJoinAs = value
	}
	if c.Flags.Has(16) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field theme_emoticon: %w", err)
		}
		c.ThemeEmoticon = value
	}
	if c.Flags.Has(17) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field requests_pending: %w", err)
		}
		c.RequestsPending = value
	}
	if c.Flags.Has(17) {
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field recent_requesters: %w", err)
		}

		if headerLen > 0 {
			c.RecentRequesters = make([]int64, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatFull#c9d31138: field recent_requesters: %w", err)
			}
			c.RecentRequesters = append(c.RecentRequesters, value)
		}
	}
	if c.Flags.Has(18) {
		value, err := DecodeChatReactions(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatFull#c9d31138: field available_reactions: %w", err)
		}
		c.AvailableReactions = value
	}
	return nil
}

// SetCanSetUsername sets value of CanSetUsername conditional field.
func (c *ChatFull) SetCanSetUsername(value bool) {
	if value {
		c.Flags.Set(7)
		c.CanSetUsername = true
	} else {
		c.Flags.Unset(7)
		c.CanSetUsername = false
	}
}

// GetCanSetUsername returns value of CanSetUsername conditional field.
func (c *ChatFull) GetCanSetUsername() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(7)
}

// SetHasScheduled sets value of HasScheduled conditional field.
func (c *ChatFull) SetHasScheduled(value bool) {
	if value {
		c.Flags.Set(8)
		c.HasScheduled = true
	} else {
		c.Flags.Unset(8)
		c.HasScheduled = false
	}
}

// GetHasScheduled returns value of HasScheduled conditional field.
func (c *ChatFull) GetHasScheduled() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(8)
}

// SetTranslationsDisabled sets value of TranslationsDisabled conditional field.
func (c *ChatFull) SetTranslationsDisabled(value bool) {
	if value {
		c.Flags.Set(19)
		c.TranslationsDisabled = true
	} else {
		c.Flags.Unset(19)
		c.TranslationsDisabled = false
	}
}

// GetTranslationsDisabled returns value of TranslationsDisabled conditional field.
func (c *ChatFull) GetTranslationsDisabled() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(19)
}

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

// GetAbout returns value of About field.
func (c *ChatFull) GetAbout() (value string) {
	if c == nil {
		return
	}
	return c.About
}

// GetParticipants returns value of Participants field.
func (c *ChatFull) GetParticipants() (value ChatParticipantsClass) {
	if c == nil {
		return
	}
	return c.Participants
}

// SetChatPhoto sets value of ChatPhoto conditional field.
func (c *ChatFull) SetChatPhoto(value PhotoClass) {
	c.Flags.Set(2)
	c.ChatPhoto = value
}

// GetChatPhoto returns value of ChatPhoto conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetChatPhoto() (value PhotoClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(2) {
		return value, false
	}
	return c.ChatPhoto, true
}

// GetNotifySettings returns value of NotifySettings field.
func (c *ChatFull) GetNotifySettings() (value PeerNotifySettings) {
	if c == nil {
		return
	}
	return c.NotifySettings
}

// SetExportedInvite sets value of ExportedInvite conditional field.
func (c *ChatFull) SetExportedInvite(value ExportedChatInviteClass) {
	c.Flags.Set(13)
	c.ExportedInvite = value
}

// GetExportedInvite returns value of ExportedInvite conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetExportedInvite() (value ExportedChatInviteClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(13) {
		return value, false
	}
	return c.ExportedInvite, true
}

// SetBotInfo sets value of BotInfo conditional field.
func (c *ChatFull) SetBotInfo(value []BotInfo) {
	c.Flags.Set(3)
	c.BotInfo = value
}

// GetBotInfo returns value of BotInfo conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetBotInfo() (value []BotInfo, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(3) {
		return value, false
	}
	return c.BotInfo, true
}

// SetPinnedMsgID sets value of PinnedMsgID conditional field.
func (c *ChatFull) SetPinnedMsgID(value int) {
	c.Flags.Set(6)
	c.PinnedMsgID = value
}

// GetPinnedMsgID returns value of PinnedMsgID conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetPinnedMsgID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(6) {
		return value, false
	}
	return c.PinnedMsgID, true
}

// SetFolderID sets value of FolderID conditional field.
func (c *ChatFull) SetFolderID(value int) {
	c.Flags.Set(11)
	c.FolderID = value
}

// GetFolderID returns value of FolderID conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetFolderID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(11) {
		return value, false
	}
	return c.FolderID, true
}

// SetCall sets value of Call conditional field.
func (c *ChatFull) SetCall(value InputGroupCall) {
	c.Flags.Set(12)
	c.Call = value
}

// GetCall returns value of Call conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetCall() (value InputGroupCall, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(12) {
		return value, false
	}
	return c.Call, true
}

// SetTTLPeriod sets value of TTLPeriod conditional field.
func (c *ChatFull) SetTTLPeriod(value int) {
	c.Flags.Set(14)
	c.TTLPeriod = value
}

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

// SetGroupcallDefaultJoinAs sets value of GroupcallDefaultJoinAs conditional field.
func (c *ChatFull) SetGroupcallDefaultJoinAs(value PeerClass) {
	c.Flags.Set(15)
	c.GroupcallDefaultJoinAs = value
}

// GetGroupcallDefaultJoinAs returns value of GroupcallDefaultJoinAs conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(15) {
		return value, false
	}
	return c.GroupcallDefaultJoinAs, true
}

// SetThemeEmoticon sets value of ThemeEmoticon conditional field.
func (c *ChatFull) SetThemeEmoticon(value string) {
	c.Flags.Set(16)
	c.ThemeEmoticon = value
}

// GetThemeEmoticon returns value of ThemeEmoticon conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetThemeEmoticon() (value string, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(16) {
		return value, false
	}
	return c.ThemeEmoticon, true
}

// SetRequestsPending sets value of RequestsPending conditional field.
func (c *ChatFull) SetRequestsPending(value int) {
	c.Flags.Set(17)
	c.RequestsPending = value
}

// GetRequestsPending returns value of RequestsPending conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetRequestsPending() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(17) {
		return value, false
	}
	return c.RequestsPending, true
}

// SetRecentRequesters sets value of RecentRequesters conditional field.
func (c *ChatFull) SetRecentRequesters(value []int64) {
	c.Flags.Set(17)
	c.RecentRequesters = value
}

// GetRecentRequesters returns value of RecentRequesters conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetRecentRequesters() (value []int64, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(17) {
		return value, false
	}
	return c.RecentRequesters, true
}

// SetAvailableReactions sets value of AvailableReactions conditional field.
func (c *ChatFull) SetAvailableReactions(value ChatReactionsClass) {
	c.Flags.Set(18)
	c.AvailableReactions = value
}

// GetAvailableReactions returns value of AvailableReactions conditional field and
// boolean which is true if field was set.
func (c *ChatFull) GetAvailableReactions() (value ChatReactionsClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(18) {
		return value, false
	}
	return c.AvailableReactions, true
}

// ChannelFull represents TL type `channelFull#f2355507`.
// Full info about a channel¹, supergroup² or gigagroup³.
//
// Links:
//  1. https://core.telegram.org/api/channel#channels
//  2. https://core.telegram.org/api/channel#supergroups
//  3. https://core.telegram.org/api/channel#gigagroups
//
// See https://core.telegram.org/constructor/channelFull for reference.
type ChannelFull struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Can we view the participant list?
	CanViewParticipants bool
	// Can we set the channel's username?
	CanSetUsername bool
	// Can we associate¹ a stickerpack to the supergroup?
	//
	// Links:
	//  1) https://core.telegram.org/method/channels.setStickers
	CanSetStickers bool
	// Is the history before we joined hidden to us?
	HiddenPrehistory bool
	// Can we set the geolocation of this group (for geogroups)
	CanSetLocation bool
	// Whether scheduled messages are available
	HasScheduled bool
	// Can the user view channel/supergroup statistics¹
	//
	// Links:
	//  1) https://core.telegram.org/api/stats
	CanViewStats bool
	// Whether any anonymous admin of this supergroup was blocked: if set, you won't receive
	// messages from anonymous group admins in discussion replies via @replies¹
	//
	// Links:
	//  1) https://core.telegram.org/api/discussion
	Blocked bool
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags2 bin.Fields
	// Can we delete this channel?
	CanDeleteChannel bool
	// Whether native antispam¹ functionality is enabled in this supergroup.
	//
	// Links:
	//  1) https://core.telegram.org/api/antispam
	Antispam bool
	// Whether the participant list is hidden.
	ParticipantsHidden bool
	// Whether the real-time chat translation popup¹ should be hidden.
	//
	// Links:
	//  1) https://core.telegram.org/api/translation
	TranslationsDisabled bool
	// ID of the channel
	ID int64
	// Info about the channel
	About string
	// Number of participants of the channel
	//
	// Use SetParticipantsCount and GetParticipantsCount helpers.
	ParticipantsCount int
	// Number of channel admins
	//
	// Use SetAdminsCount and GetAdminsCount helpers.
	AdminsCount int
	// Number of users kicked¹ from the channel
	//
	// Links:
	//  1) https://core.telegram.org/api/rights
	//
	// Use SetKickedCount and GetKickedCount helpers.
	KickedCount int
	// Number of users banned¹ from the channel
	//
	// Links:
	//  1) https://core.telegram.org/api/rights
	//
	// Use SetBannedCount and GetBannedCount helpers.
	BannedCount int
	// Number of users currently online
	//
	// Use SetOnlineCount and GetOnlineCount helpers.
	OnlineCount int
	// Position up to which all incoming messages are read.
	ReadInboxMaxID int
	// Position up to which all outgoing messages are read.
	ReadOutboxMaxID int
	// Count of unread messages
	UnreadCount int
	// Channel picture
	ChatPhoto PhotoClass
	// Notification settings
	NotifySettings PeerNotifySettings
	// Invite link
	//
	// Use SetExportedInvite and GetExportedInvite helpers.
	ExportedInvite ExportedChatInviteClass
	// Info about bots in the channel/supergroup
	BotInfo []BotInfo
	// The chat ID from which this group was migrated¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	//
	// Use SetMigratedFromChatID and GetMigratedFromChatID helpers.
	MigratedFromChatID int64
	// The message ID in the original chat at which this group was migrated¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	//
	// Use SetMigratedFromMaxID and GetMigratedFromMaxID helpers.
	MigratedFromMaxID int
	// Message ID of the last pinned message¹
	//
	// Links:
	//  1) https://core.telegram.org/api/pin
	//
	// Use SetPinnedMsgID and GetPinnedMsgID helpers.
	PinnedMsgID int
	// Associated stickerset
	//
	// Use SetStickerset and GetStickerset helpers.
	Stickerset StickerSet
	// Identifier of a maximum unavailable message in a channel due to hidden history.
	//
	// Use SetAvailableMinID and GetAvailableMinID helpers.
	AvailableMinID int
	// Peer folder ID, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/folders#peer-folders
	//
	// Use SetFolderID and GetFolderID helpers.
	FolderID int
	// ID of the linked discussion chat¹ for channels
	//
	// Links:
	//  1) https://core.telegram.org/api/discussion
	//
	// Use SetLinkedChatID and GetLinkedChatID helpers.
	LinkedChatID int64
	// Location of the geogroup
	//
	// Use SetLocation and GetLocation helpers.
	Location ChannelLocationClass
	// If specified, users in supergroups will only be able to send one message every
	// slowmode_seconds seconds
	//
	// Use SetSlowmodeSeconds and GetSlowmodeSeconds helpers.
	SlowmodeSeconds int
	// Indicates when the user will be allowed to send another message in the supergroup
	// (unixtime)
	//
	// Use SetSlowmodeNextSendDate and GetSlowmodeNextSendDate helpers.
	SlowmodeNextSendDate int
	// If set, specifies the DC to use for fetching channel statistics
	//
	// Use SetStatsDC and GetStatsDC helpers.
	StatsDC int
	// Latest PTS¹ for this channel
	//
	// Links:
	//  1) https://core.telegram.org/api/updates
	Pts int
	// Livestream or group call information
	//
	// Use SetCall and GetCall helpers.
	Call InputGroupCall
	// Time-To-Live of messages in this channel or supergroup
	//
	// Use SetTTLPeriod and GetTTLPeriod helpers.
	TTLPeriod int
	// A list of suggested actions¹ for the supergroup admin, see here for more info »².
	//
	// Links:
	//  1) https://core.telegram.org/api/config#suggestions
	//  2) https://core.telegram.org/api/config#suggestions
	//
	// Use SetPendingSuggestions and GetPendingSuggestions helpers.
	PendingSuggestions []string
	// When using phone.getGroupCallJoinAs¹ to get a list of peers that can be used to join
	// a group call, this field indicates the peer that should be selected by default.
	//
	// Links:
	//  1) https://core.telegram.org/method/phone.getGroupCallJoinAs
	//
	// Use SetGroupcallDefaultJoinAs and GetGroupcallDefaultJoinAs helpers.
	GroupcallDefaultJoinAs PeerClass
	// Emoji representing a specific chat theme
	//
	// Use SetThemeEmoticon and GetThemeEmoticon helpers.
	ThemeEmoticon string
	// Pending join requests »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	//
	// Use SetRequestsPending and GetRequestsPending helpers.
	RequestsPending int
	// IDs of users who requested to join recently
	//
	// Use SetRecentRequesters and GetRecentRequesters helpers.
	RecentRequesters []int64
	// Default peer used for sending messages to this channel
	//
	// Use SetDefaultSendAs and GetDefaultSendAs helpers.
	DefaultSendAs PeerClass
	// Allowed message reactions »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/reactions
	//
	// Use SetAvailableReactions and GetAvailableReactions helpers.
	AvailableReactions ChatReactionsClass
}

// ChannelFullTypeID is TL type id of ChannelFull.
const ChannelFullTypeID = 0xf2355507

// construct implements constructor of ChatFullClass.
func (c ChannelFull) construct() ChatFullClass { return &c }

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

	_ ChatFullClass = &ChannelFull{}
)

func (c *ChannelFull) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Flags.Zero()) {
		return false
	}
	if !(c.CanViewParticipants == false) {
		return false
	}
	if !(c.CanSetUsername == false) {
		return false
	}
	if !(c.CanSetStickers == false) {
		return false
	}
	if !(c.HiddenPrehistory == false) {
		return false
	}
	if !(c.CanSetLocation == false) {
		return false
	}
	if !(c.HasScheduled == false) {
		return false
	}
	if !(c.CanViewStats == false) {
		return false
	}
	if !(c.Blocked == false) {
		return false
	}
	if !(c.Flags2.Zero()) {
		return false
	}
	if !(c.CanDeleteChannel == false) {
		return false
	}
	if !(c.Antispam == false) {
		return false
	}
	if !(c.ParticipantsHidden == false) {
		return false
	}
	if !(c.TranslationsDisabled == false) {
		return false
	}
	if !(c.ID == 0) {
		return false
	}
	if !(c.About == "") {
		return false
	}
	if !(c.ParticipantsCount == 0) {
		return false
	}
	if !(c.AdminsCount == 0) {
		return false
	}
	if !(c.KickedCount == 0) {
		return false
	}
	if !(c.BannedCount == 0) {
		return false
	}
	if !(c.OnlineCount == 0) {
		return false
	}
	if !(c.ReadInboxMaxID == 0) {
		return false
	}
	if !(c.ReadOutboxMaxID == 0) {
		return false
	}
	if !(c.UnreadCount == 0) {
		return false
	}
	if !(c.ChatPhoto == nil) {
		return false
	}
	if !(c.NotifySettings.Zero()) {
		return false
	}
	if !(c.ExportedInvite == nil) {
		return false
	}
	if !(c.BotInfo == nil) {
		return false
	}
	if !(c.MigratedFromChatID == 0) {
		return false
	}
	if !(c.MigratedFromMaxID == 0) {
		return false
	}
	if !(c.PinnedMsgID == 0) {
		return false
	}
	if !(c.Stickerset.Zero()) {
		return false
	}
	if !(c.AvailableMinID == 0) {
		return false
	}
	if !(c.FolderID == 0) {
		return false
	}
	if !(c.LinkedChatID == 0) {
		return false
	}
	if !(c.Location == nil) {
		return false
	}
	if !(c.SlowmodeSeconds == 0) {
		return false
	}
	if !(c.SlowmodeNextSendDate == 0) {
		return false
	}
	if !(c.StatsDC == 0) {
		return false
	}
	if !(c.Pts == 0) {
		return false
	}
	if !(c.Call.Zero()) {
		return false
	}
	if !(c.TTLPeriod == 0) {
		return false
	}
	if !(c.PendingSuggestions == nil) {
		return false
	}
	if !(c.GroupcallDefaultJoinAs == nil) {
		return false
	}
	if !(c.ThemeEmoticon == "") {
		return false
	}
	if !(c.RequestsPending == 0) {
		return false
	}
	if !(c.RecentRequesters == nil) {
		return false
	}
	if !(c.DefaultSendAs == nil) {
		return false
	}
	if !(c.AvailableReactions == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelFull from given interface.
func (c *ChannelFull) FillFrom(from interface {
	GetCanViewParticipants() (value bool)
	GetCanSetUsername() (value bool)
	GetCanSetStickers() (value bool)
	GetHiddenPrehistory() (value bool)
	GetCanSetLocation() (value bool)
	GetHasScheduled() (value bool)
	GetCanViewStats() (value bool)
	GetBlocked() (value bool)
	GetCanDeleteChannel() (value bool)
	GetAntispam() (value bool)
	GetParticipantsHidden() (value bool)
	GetTranslationsDisabled() (value bool)
	GetID() (value int64)
	GetAbout() (value string)
	GetParticipantsCount() (value int, ok bool)
	GetAdminsCount() (value int, ok bool)
	GetKickedCount() (value int, ok bool)
	GetBannedCount() (value int, ok bool)
	GetOnlineCount() (value int, ok bool)
	GetReadInboxMaxID() (value int)
	GetReadOutboxMaxID() (value int)
	GetUnreadCount() (value int)
	GetChatPhoto() (value PhotoClass)
	GetNotifySettings() (value PeerNotifySettings)
	GetExportedInvite() (value ExportedChatInviteClass, ok bool)
	GetBotInfo() (value []BotInfo)
	GetMigratedFromChatID() (value int64, ok bool)
	GetMigratedFromMaxID() (value int, ok bool)
	GetPinnedMsgID() (value int, ok bool)
	GetStickerset() (value StickerSet, ok bool)
	GetAvailableMinID() (value int, ok bool)
	GetFolderID() (value int, ok bool)
	GetLinkedChatID() (value int64, ok bool)
	GetLocation() (value ChannelLocationClass, ok bool)
	GetSlowmodeSeconds() (value int, ok bool)
	GetSlowmodeNextSendDate() (value int, ok bool)
	GetStatsDC() (value int, ok bool)
	GetPts() (value int)
	GetCall() (value InputGroupCall, ok bool)
	GetTTLPeriod() (value int, ok bool)
	GetPendingSuggestions() (value []string, ok bool)
	GetGroupcallDefaultJoinAs() (value PeerClass, ok bool)
	GetThemeEmoticon() (value string, ok bool)
	GetRequestsPending() (value int, ok bool)
	GetRecentRequesters() (value []int64, ok bool)
	GetDefaultSendAs() (value PeerClass, ok bool)
	GetAvailableReactions() (value ChatReactionsClass, ok bool)
}) {
	c.CanViewParticipants = from.GetCanViewParticipants()
	c.CanSetUsername = from.GetCanSetUsername()
	c.CanSetStickers = from.GetCanSetStickers()
	c.HiddenPrehistory = from.GetHiddenPrehistory()
	c.CanSetLocation = from.GetCanSetLocation()
	c.HasScheduled = from.GetHasScheduled()
	c.CanViewStats = from.GetCanViewStats()
	c.Blocked = from.GetBlocked()
	c.CanDeleteChannel = from.GetCanDeleteChannel()
	c.Antispam = from.GetAntispam()
	c.ParticipantsHidden = from.GetParticipantsHidden()
	c.TranslationsDisabled = from.GetTranslationsDisabled()
	c.ID = from.GetID()
	c.About = from.GetAbout()
	if val, ok := from.GetParticipantsCount(); ok {
		c.ParticipantsCount = val
	}

	if val, ok := from.GetAdminsCount(); ok {
		c.AdminsCount = val
	}

	if val, ok := from.GetKickedCount(); ok {
		c.KickedCount = val
	}

	if val, ok := from.GetBannedCount(); ok {
		c.BannedCount = val
	}

	if val, ok := from.GetOnlineCount(); ok {
		c.OnlineCount = val
	}

	c.ReadInboxMaxID = from.GetReadInboxMaxID()
	c.ReadOutboxMaxID = from.GetReadOutboxMaxID()
	c.UnreadCount = from.GetUnreadCount()
	c.ChatPhoto = from.GetChatPhoto()
	c.NotifySettings = from.GetNotifySettings()
	if val, ok := from.GetExportedInvite(); ok {
		c.ExportedInvite = val
	}

	c.BotInfo = from.GetBotInfo()
	if val, ok := from.GetMigratedFromChatID(); ok {
		c.MigratedFromChatID = val
	}

	if val, ok := from.GetMigratedFromMaxID(); ok {
		c.MigratedFromMaxID = val
	}

	if val, ok := from.GetPinnedMsgID(); ok {
		c.PinnedMsgID = val
	}

	if val, ok := from.GetStickerset(); ok {
		c.Stickerset = val
	}

	if val, ok := from.GetAvailableMinID(); ok {
		c.AvailableMinID = val
	}

	if val, ok := from.GetFolderID(); ok {
		c.FolderID = val
	}

	if val, ok := from.GetLinkedChatID(); ok {
		c.LinkedChatID = val
	}

	if val, ok := from.GetLocation(); ok {
		c.Location = val
	}

	if val, ok := from.GetSlowmodeSeconds(); ok {
		c.SlowmodeSeconds = val
	}

	if val, ok := from.GetSlowmodeNextSendDate(); ok {
		c.SlowmodeNextSendDate = val
	}

	if val, ok := from.GetStatsDC(); ok {
		c.StatsDC = val
	}

	c.Pts = from.GetPts()
	if val, ok := from.GetCall(); ok {
		c.Call = val
	}

	if val, ok := from.GetTTLPeriod(); ok {
		c.TTLPeriod = val
	}

	if val, ok := from.GetPendingSuggestions(); ok {
		c.PendingSuggestions = val
	}

	if val, ok := from.GetGroupcallDefaultJoinAs(); ok {
		c.GroupcallDefaultJoinAs = val
	}

	if val, ok := from.GetThemeEmoticon(); ok {
		c.ThemeEmoticon = val
	}

	if val, ok := from.GetRequestsPending(); ok {
		c.RequestsPending = val
	}

	if val, ok := from.GetRecentRequesters(); ok {
		c.RecentRequesters = val
	}

	if val, ok := from.GetDefaultSendAs(); ok {
		c.DefaultSendAs = val
	}

	if val, ok := from.GetAvailableReactions(); ok {
		c.AvailableReactions = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (c *ChannelFull) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "channelFull",
		ID:   ChannelFullTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "CanViewParticipants",
			SchemaName: "can_view_participants",
			Null:       !c.Flags.Has(3),
		},
		{
			Name:       "CanSetUsername",
			SchemaName: "can_set_username",
			Null:       !c.Flags.Has(6),
		},
		{
			Name:       "CanSetStickers",
			SchemaName: "can_set_stickers",
			Null:       !c.Flags.Has(7),
		},
		{
			Name:       "HiddenPrehistory",
			SchemaName: "hidden_prehistory",
			Null:       !c.Flags.Has(10),
		},
		{
			Name:       "CanSetLocation",
			SchemaName: "can_set_location",
			Null:       !c.Flags.Has(16),
		},
		{
			Name:       "HasScheduled",
			SchemaName: "has_scheduled",
			Null:       !c.Flags.Has(19),
		},
		{
			Name:       "CanViewStats",
			SchemaName: "can_view_stats",
			Null:       !c.Flags.Has(20),
		},
		{
			Name:       "Blocked",
			SchemaName: "blocked",
			Null:       !c.Flags.Has(22),
		},
		{
			Name:       "CanDeleteChannel",
			SchemaName: "can_delete_channel",
			Null:       !c.Flags2.Has(0),
		},
		{
			Name:       "Antispam",
			SchemaName: "antispam",
			Null:       !c.Flags2.Has(1),
		},
		{
			Name:       "ParticipantsHidden",
			SchemaName: "participants_hidden",
			Null:       !c.Flags2.Has(2),
		},
		{
			Name:       "TranslationsDisabled",
			SchemaName: "translations_disabled",
			Null:       !c.Flags2.Has(3),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "About",
			SchemaName: "about",
		},
		{
			Name:       "ParticipantsCount",
			SchemaName: "participants_count",
			Null:       !c.Flags.Has(0),
		},
		{
			Name:       "AdminsCount",
			SchemaName: "admins_count",
			Null:       !c.Flags.Has(1),
		},
		{
			Name:       "KickedCount",
			SchemaName: "kicked_count",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "BannedCount",
			SchemaName: "banned_count",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "OnlineCount",
			SchemaName: "online_count",
			Null:       !c.Flags.Has(13),
		},
		{
			Name:       "ReadInboxMaxID",
			SchemaName: "read_inbox_max_id",
		},
		{
			Name:       "ReadOutboxMaxID",
			SchemaName: "read_outbox_max_id",
		},
		{
			Name:       "UnreadCount",
			SchemaName: "unread_count",
		},
		{
			Name:       "ChatPhoto",
			SchemaName: "chat_photo",
		},
		{
			Name:       "NotifySettings",
			SchemaName: "notify_settings",
		},
		{
			Name:       "ExportedInvite",
			SchemaName: "exported_invite",
			Null:       !c.Flags.Has(23),
		},
		{
			Name:       "BotInfo",
			SchemaName: "bot_info",
		},
		{
			Name:       "MigratedFromChatID",
			SchemaName: "migrated_from_chat_id",
			Null:       !c.Flags.Has(4),
		},
		{
			Name:       "MigratedFromMaxID",
			SchemaName: "migrated_from_max_id",
			Null:       !c.Flags.Has(4),
		},
		{
			Name:       "PinnedMsgID",
			SchemaName: "pinned_msg_id",
			Null:       !c.Flags.Has(5),
		},
		{
			Name:       "Stickerset",
			SchemaName: "stickerset",
			Null:       !c.Flags.Has(8),
		},
		{
			Name:       "AvailableMinID",
			SchemaName: "available_min_id",
			Null:       !c.Flags.Has(9),
		},
		{
			Name:       "FolderID",
			SchemaName: "folder_id",
			Null:       !c.Flags.Has(11),
		},
		{
			Name:       "LinkedChatID",
			SchemaName: "linked_chat_id",
			Null:       !c.Flags.Has(14),
		},
		{
			Name:       "Location",
			SchemaName: "location",
			Null:       !c.Flags.Has(15),
		},
		{
			Name:       "SlowmodeSeconds",
			SchemaName: "slowmode_seconds",
			Null:       !c.Flags.Has(17),
		},
		{
			Name:       "SlowmodeNextSendDate",
			SchemaName: "slowmode_next_send_date",
			Null:       !c.Flags.Has(18),
		},
		{
			Name:       "StatsDC",
			SchemaName: "stats_dc",
			Null:       !c.Flags.Has(12),
		},
		{
			Name:       "Pts",
			SchemaName: "pts",
		},
		{
			Name:       "Call",
			SchemaName: "call",
			Null:       !c.Flags.Has(21),
		},
		{
			Name:       "TTLPeriod",
			SchemaName: "ttl_period",
			Null:       !c.Flags.Has(24),
		},
		{
			Name:       "PendingSuggestions",
			SchemaName: "pending_suggestions",
			Null:       !c.Flags.Has(25),
		},
		{
			Name:       "GroupcallDefaultJoinAs",
			SchemaName: "groupcall_default_join_as",
			Null:       !c.Flags.Has(26),
		},
		{
			Name:       "ThemeEmoticon",
			SchemaName: "theme_emoticon",
			Null:       !c.Flags.Has(27),
		},
		{
			Name:       "RequestsPending",
			SchemaName: "requests_pending",
			Null:       !c.Flags.Has(28),
		},
		{
			Name:       "RecentRequesters",
			SchemaName: "recent_requesters",
			Null:       !c.Flags.Has(28),
		},
		{
			Name:       "DefaultSendAs",
			SchemaName: "default_send_as",
			Null:       !c.Flags.Has(29),
		},
		{
			Name:       "AvailableReactions",
			SchemaName: "available_reactions",
			Null:       !c.Flags.Has(30),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (c *ChannelFull) SetFlags() {
	if !(c.CanViewParticipants == false) {
		c.Flags.Set(3)
	}
	if !(c.CanSetUsername == false) {
		c.Flags.Set(6)
	}
	if !(c.CanSetStickers == false) {
		c.Flags.Set(7)
	}
	if !(c.HiddenPrehistory == false) {
		c.Flags.Set(10)
	}
	if !(c.CanSetLocation == false) {
		c.Flags.Set(16)
	}
	if !(c.HasScheduled == false) {
		c.Flags.Set(19)
	}
	if !(c.CanViewStats == false) {
		c.Flags.Set(20)
	}
	if !(c.Blocked == false) {
		c.Flags.Set(22)
	}
	if !(c.CanDeleteChannel == false) {
		c.Flags2.Set(0)
	}
	if !(c.Antispam == false) {
		c.Flags2.Set(1)
	}
	if !(c.ParticipantsHidden == false) {
		c.Flags2.Set(2)
	}
	if !(c.TranslationsDisabled == false) {
		c.Flags2.Set(3)
	}
	if !(c.ParticipantsCount == 0) {
		c.Flags.Set(0)
	}
	if !(c.AdminsCount == 0) {
		c.Flags.Set(1)
	}
	if !(c.KickedCount == 0) {
		c.Flags.Set(2)
	}
	if !(c.BannedCount == 0) {
		c.Flags.Set(2)
	}
	if !(c.OnlineCount == 0) {
		c.Flags.Set(13)
	}
	if !(c.ExportedInvite == nil) {
		c.Flags.Set(23)
	}
	if !(c.MigratedFromChatID == 0) {
		c.Flags.Set(4)
	}
	if !(c.MigratedFromMaxID == 0) {
		c.Flags.Set(4)
	}
	if !(c.PinnedMsgID == 0) {
		c.Flags.Set(5)
	}
	if !(c.Stickerset.Zero()) {
		c.Flags.Set(8)
	}
	if !(c.AvailableMinID == 0) {
		c.Flags.Set(9)
	}
	if !(c.FolderID == 0) {
		c.Flags.Set(11)
	}
	if !(c.LinkedChatID == 0) {
		c.Flags.Set(14)
	}
	if !(c.Location == nil) {
		c.Flags.Set(15)
	}
	if !(c.SlowmodeSeconds == 0) {
		c.Flags.Set(17)
	}
	if !(c.SlowmodeNextSendDate == 0) {
		c.Flags.Set(18)
	}
	if !(c.StatsDC == 0) {
		c.Flags.Set(12)
	}
	if !(c.Call.Zero()) {
		c.Flags.Set(21)
	}
	if !(c.TTLPeriod == 0) {
		c.Flags.Set(24)
	}
	if !(c.PendingSuggestions == nil) {
		c.Flags.Set(25)
	}
	if !(c.GroupcallDefaultJoinAs == nil) {
		c.Flags.Set(26)
	}
	if !(c.ThemeEmoticon == "") {
		c.Flags.Set(27)
	}
	if !(c.RequestsPending == 0) {
		c.Flags.Set(28)
	}
	if !(c.RecentRequesters == nil) {
		c.Flags.Set(28)
	}
	if !(c.DefaultSendAs == nil) {
		c.Flags.Set(29)
	}
	if !(c.AvailableReactions == nil) {
		c.Flags.Set(30)
	}
}

// Encode implements bin.Encoder.
func (c *ChannelFull) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode channelFull#f2355507 as nil")
	}
	b.PutID(ChannelFullTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChannelFull) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode channelFull#f2355507 as nil")
	}
	c.SetFlags()
	if err := c.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode channelFull#f2355507: field flags: %w", err)
	}
	if err := c.Flags2.Encode(b); err != nil {
		return fmt.Errorf("unable to encode channelFull#f2355507: field flags2: %w", err)
	}
	b.PutLong(c.ID)
	b.PutString(c.About)
	if c.Flags.Has(0) {
		b.PutInt(c.ParticipantsCount)
	}
	if c.Flags.Has(1) {
		b.PutInt(c.AdminsCount)
	}
	if c.Flags.Has(2) {
		b.PutInt(c.KickedCount)
	}
	if c.Flags.Has(2) {
		b.PutInt(c.BannedCount)
	}
	if c.Flags.Has(13) {
		b.PutInt(c.OnlineCount)
	}
	b.PutInt(c.ReadInboxMaxID)
	b.PutInt(c.ReadOutboxMaxID)
	b.PutInt(c.UnreadCount)
	if c.ChatPhoto == nil {
		return fmt.Errorf("unable to encode channelFull#f2355507: field chat_photo is nil")
	}
	if err := c.ChatPhoto.Encode(b); err != nil {
		return fmt.Errorf("unable to encode channelFull#f2355507: field chat_photo: %w", err)
	}
	if err := c.NotifySettings.Encode(b); err != nil {
		return fmt.Errorf("unable to encode channelFull#f2355507: field notify_settings: %w", err)
	}
	if c.Flags.Has(23) {
		if c.ExportedInvite == nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field exported_invite is nil")
		}
		if err := c.ExportedInvite.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field exported_invite: %w", err)
		}
	}
	b.PutVectorHeader(len(c.BotInfo))
	for idx, v := range c.BotInfo {
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field bot_info element with index %d: %w", idx, err)
		}
	}
	if c.Flags.Has(4) {
		b.PutLong(c.MigratedFromChatID)
	}
	if c.Flags.Has(4) {
		b.PutInt(c.MigratedFromMaxID)
	}
	if c.Flags.Has(5) {
		b.PutInt(c.PinnedMsgID)
	}
	if c.Flags.Has(8) {
		if err := c.Stickerset.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field stickerset: %w", err)
		}
	}
	if c.Flags.Has(9) {
		b.PutInt(c.AvailableMinID)
	}
	if c.Flags.Has(11) {
		b.PutInt(c.FolderID)
	}
	if c.Flags.Has(14) {
		b.PutLong(c.LinkedChatID)
	}
	if c.Flags.Has(15) {
		if c.Location == nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field location is nil")
		}
		if err := c.Location.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field location: %w", err)
		}
	}
	if c.Flags.Has(17) {
		b.PutInt(c.SlowmodeSeconds)
	}
	if c.Flags.Has(18) {
		b.PutInt(c.SlowmodeNextSendDate)
	}
	if c.Flags.Has(12) {
		b.PutInt(c.StatsDC)
	}
	b.PutInt(c.Pts)
	if c.Flags.Has(21) {
		if err := c.Call.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field call: %w", err)
		}
	}
	if c.Flags.Has(24) {
		b.PutInt(c.TTLPeriod)
	}
	if c.Flags.Has(25) {
		b.PutVectorHeader(len(c.PendingSuggestions))
		for _, v := range c.PendingSuggestions {
			b.PutString(v)
		}
	}
	if c.Flags.Has(26) {
		if c.GroupcallDefaultJoinAs == nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field groupcall_default_join_as is nil")
		}
		if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field groupcall_default_join_as: %w", err)
		}
	}
	if c.Flags.Has(27) {
		b.PutString(c.ThemeEmoticon)
	}
	if c.Flags.Has(28) {
		b.PutInt(c.RequestsPending)
	}
	if c.Flags.Has(28) {
		b.PutVectorHeader(len(c.RecentRequesters))
		for _, v := range c.RecentRequesters {
			b.PutLong(v)
		}
	}
	if c.Flags.Has(29) {
		if c.DefaultSendAs == nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field default_send_as is nil")
		}
		if err := c.DefaultSendAs.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field default_send_as: %w", err)
		}
	}
	if c.Flags.Has(30) {
		if c.AvailableReactions == nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field available_reactions is nil")
		}
		if err := c.AvailableReactions.Encode(b); err != nil {
			return fmt.Errorf("unable to encode channelFull#f2355507: field available_reactions: %w", err)
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChannelFull) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode channelFull#f2355507 to nil")
	}
	if err := b.ConsumeID(ChannelFullTypeID); err != nil {
		return fmt.Errorf("unable to decode channelFull#f2355507: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChannelFull) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode channelFull#f2355507 to nil")
	}
	{
		if err := c.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field flags: %w", err)
		}
	}
	c.CanViewParticipants = c.Flags.Has(3)
	c.CanSetUsername = c.Flags.Has(6)
	c.CanSetStickers = c.Flags.Has(7)
	c.HiddenPrehistory = c.Flags.Has(10)
	c.CanSetLocation = c.Flags.Has(16)
	c.HasScheduled = c.Flags.Has(19)
	c.CanViewStats = c.Flags.Has(20)
	c.Blocked = c.Flags.Has(22)
	{
		if err := c.Flags2.Decode(b); err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field flags2: %w", err)
		}
	}
	c.CanDeleteChannel = c.Flags2.Has(0)
	c.Antispam = c.Flags2.Has(1)
	c.ParticipantsHidden = c.Flags2.Has(2)
	c.TranslationsDisabled = c.Flags2.Has(3)
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field id: %w", err)
		}
		c.ID = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field about: %w", err)
		}
		c.About = value
	}
	if c.Flags.Has(0) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field participants_count: %w", err)
		}
		c.ParticipantsCount = value
	}
	if c.Flags.Has(1) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field admins_count: %w", err)
		}
		c.AdminsCount = value
	}
	if c.Flags.Has(2) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field kicked_count: %w", err)
		}
		c.KickedCount = value
	}
	if c.Flags.Has(2) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field banned_count: %w", err)
		}
		c.BannedCount = value
	}
	if c.Flags.Has(13) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field online_count: %w", err)
		}
		c.OnlineCount = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field read_inbox_max_id: %w", err)
		}
		c.ReadInboxMaxID = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field read_outbox_max_id: %w", err)
		}
		c.ReadOutboxMaxID = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field unread_count: %w", err)
		}
		c.UnreadCount = value
	}
	{
		value, err := DecodePhoto(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field chat_photo: %w", err)
		}
		c.ChatPhoto = value
	}
	{
		if err := c.NotifySettings.Decode(b); err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field notify_settings: %w", err)
		}
	}
	if c.Flags.Has(23) {
		value, err := DecodeExportedChatInvite(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field exported_invite: %w", err)
		}
		c.ExportedInvite = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field bot_info: %w", err)
		}

		if headerLen > 0 {
			c.BotInfo = make([]BotInfo, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			var value BotInfo
			if err := value.Decode(b); err != nil {
				return fmt.Errorf("unable to decode channelFull#f2355507: field bot_info: %w", err)
			}
			c.BotInfo = append(c.BotInfo, value)
		}
	}
	if c.Flags.Has(4) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field migrated_from_chat_id: %w", err)
		}
		c.MigratedFromChatID = value
	}
	if c.Flags.Has(4) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field migrated_from_max_id: %w", err)
		}
		c.MigratedFromMaxID = value
	}
	if c.Flags.Has(5) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field pinned_msg_id: %w", err)
		}
		c.PinnedMsgID = value
	}
	if c.Flags.Has(8) {
		if err := c.Stickerset.Decode(b); err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field stickerset: %w", err)
		}
	}
	if c.Flags.Has(9) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field available_min_id: %w", err)
		}
		c.AvailableMinID = value
	}
	if c.Flags.Has(11) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field folder_id: %w", err)
		}
		c.FolderID = value
	}
	if c.Flags.Has(14) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field linked_chat_id: %w", err)
		}
		c.LinkedChatID = value
	}
	if c.Flags.Has(15) {
		value, err := DecodeChannelLocation(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field location: %w", err)
		}
		c.Location = value
	}
	if c.Flags.Has(17) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field slowmode_seconds: %w", err)
		}
		c.SlowmodeSeconds = value
	}
	if c.Flags.Has(18) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field slowmode_next_send_date: %w", err)
		}
		c.SlowmodeNextSendDate = value
	}
	if c.Flags.Has(12) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field stats_dc: %w", err)
		}
		c.StatsDC = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field pts: %w", err)
		}
		c.Pts = value
	}
	if c.Flags.Has(21) {
		if err := c.Call.Decode(b); err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field call: %w", err)
		}
	}
	if c.Flags.Has(24) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field ttl_period: %w", err)
		}
		c.TTLPeriod = value
	}
	if c.Flags.Has(25) {
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field pending_suggestions: %w", err)
		}

		if headerLen > 0 {
			c.PendingSuggestions = make([]string, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode channelFull#f2355507: field pending_suggestions: %w", err)
			}
			c.PendingSuggestions = append(c.PendingSuggestions, value)
		}
	}
	if c.Flags.Has(26) {
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field groupcall_default_join_as: %w", err)
		}
		c.GroupcallDefaultJoinAs = value
	}
	if c.Flags.Has(27) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field theme_emoticon: %w", err)
		}
		c.ThemeEmoticon = value
	}
	if c.Flags.Has(28) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field requests_pending: %w", err)
		}
		c.RequestsPending = value
	}
	if c.Flags.Has(28) {
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field recent_requesters: %w", err)
		}

		if headerLen > 0 {
			c.RecentRequesters = make([]int64, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode channelFull#f2355507: field recent_requesters: %w", err)
			}
			c.RecentRequesters = append(c.RecentRequesters, value)
		}
	}
	if c.Flags.Has(29) {
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field default_send_as: %w", err)
		}
		c.DefaultSendAs = value
	}
	if c.Flags.Has(30) {
		value, err := DecodeChatReactions(b)
		if err != nil {
			return fmt.Errorf("unable to decode channelFull#f2355507: field available_reactions: %w", err)
		}
		c.AvailableReactions = value
	}
	return nil
}

// SetCanViewParticipants sets value of CanViewParticipants conditional field.
func (c *ChannelFull) SetCanViewParticipants(value bool) {
	if value {
		c.Flags.Set(3)
		c.CanViewParticipants = true
	} else {
		c.Flags.Unset(3)
		c.CanViewParticipants = false
	}
}

// GetCanViewParticipants returns value of CanViewParticipants conditional field.
func (c *ChannelFull) GetCanViewParticipants() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(3)
}

// SetCanSetUsername sets value of CanSetUsername conditional field.
func (c *ChannelFull) SetCanSetUsername(value bool) {
	if value {
		c.Flags.Set(6)
		c.CanSetUsername = true
	} else {
		c.Flags.Unset(6)
		c.CanSetUsername = false
	}
}

// GetCanSetUsername returns value of CanSetUsername conditional field.
func (c *ChannelFull) GetCanSetUsername() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(6)
}

// SetCanSetStickers sets value of CanSetStickers conditional field.
func (c *ChannelFull) SetCanSetStickers(value bool) {
	if value {
		c.Flags.Set(7)
		c.CanSetStickers = true
	} else {
		c.Flags.Unset(7)
		c.CanSetStickers = false
	}
}

// GetCanSetStickers returns value of CanSetStickers conditional field.
func (c *ChannelFull) GetCanSetStickers() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(7)
}

// SetHiddenPrehistory sets value of HiddenPrehistory conditional field.
func (c *ChannelFull) SetHiddenPrehistory(value bool) {
	if value {
		c.Flags.Set(10)
		c.HiddenPrehistory = true
	} else {
		c.Flags.Unset(10)
		c.HiddenPrehistory = false
	}
}

// GetHiddenPrehistory returns value of HiddenPrehistory conditional field.
func (c *ChannelFull) GetHiddenPrehistory() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(10)
}

// SetCanSetLocation sets value of CanSetLocation conditional field.
func (c *ChannelFull) SetCanSetLocation(value bool) {
	if value {
		c.Flags.Set(16)
		c.CanSetLocation = true
	} else {
		c.Flags.Unset(16)
		c.CanSetLocation = false
	}
}

// GetCanSetLocation returns value of CanSetLocation conditional field.
func (c *ChannelFull) GetCanSetLocation() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(16)
}

// SetHasScheduled sets value of HasScheduled conditional field.
func (c *ChannelFull) SetHasScheduled(value bool) {
	if value {
		c.Flags.Set(19)
		c.HasScheduled = true
	} else {
		c.Flags.Unset(19)
		c.HasScheduled = false
	}
}

// GetHasScheduled returns value of HasScheduled conditional field.
func (c *ChannelFull) GetHasScheduled() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(19)
}

// SetCanViewStats sets value of CanViewStats conditional field.
func (c *ChannelFull) SetCanViewStats(value bool) {
	if value {
		c.Flags.Set(20)
		c.CanViewStats = true
	} else {
		c.Flags.Unset(20)
		c.CanViewStats = false
	}
}

// GetCanViewStats returns value of CanViewStats conditional field.
func (c *ChannelFull) GetCanViewStats() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(20)
}

// SetBlocked sets value of Blocked conditional field.
func (c *ChannelFull) SetBlocked(value bool) {
	if value {
		c.Flags.Set(22)
		c.Blocked = true
	} else {
		c.Flags.Unset(22)
		c.Blocked = false
	}
}

// GetBlocked returns value of Blocked conditional field.
func (c *ChannelFull) GetBlocked() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(22)
}

// SetCanDeleteChannel sets value of CanDeleteChannel conditional field.
func (c *ChannelFull) SetCanDeleteChannel(value bool) {
	if value {
		c.Flags2.Set(0)
		c.CanDeleteChannel = true
	} else {
		c.Flags2.Unset(0)
		c.CanDeleteChannel = false
	}
}

// GetCanDeleteChannel returns value of CanDeleteChannel conditional field.
func (c *ChannelFull) GetCanDeleteChannel() (value bool) {
	if c == nil {
		return
	}
	return c.Flags2.Has(0)
}

// SetAntispam sets value of Antispam conditional field.
func (c *ChannelFull) SetAntispam(value bool) {
	if value {
		c.Flags2.Set(1)
		c.Antispam = true
	} else {
		c.Flags2.Unset(1)
		c.Antispam = false
	}
}

// GetAntispam returns value of Antispam conditional field.
func (c *ChannelFull) GetAntispam() (value bool) {
	if c == nil {
		return
	}
	return c.Flags2.Has(1)
}

// SetParticipantsHidden sets value of ParticipantsHidden conditional field.
func (c *ChannelFull) SetParticipantsHidden(value bool) {
	if value {
		c.Flags2.Set(2)
		c.ParticipantsHidden = true
	} else {
		c.Flags2.Unset(2)
		c.ParticipantsHidden = false
	}
}

// GetParticipantsHidden returns value of ParticipantsHidden conditional field.
func (c *ChannelFull) GetParticipantsHidden() (value bool) {
	if c == nil {
		return
	}
	return c.Flags2.Has(2)
}

// SetTranslationsDisabled sets value of TranslationsDisabled conditional field.
func (c *ChannelFull) SetTranslationsDisabled(value bool) {
	if value {
		c.Flags2.Set(3)
		c.TranslationsDisabled = true
	} else {
		c.Flags2.Unset(3)
		c.TranslationsDisabled = false
	}
}

// GetTranslationsDisabled returns value of TranslationsDisabled conditional field.
func (c *ChannelFull) GetTranslationsDisabled() (value bool) {
	if c == nil {
		return
	}
	return c.Flags2.Has(3)
}

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

// GetAbout returns value of About field.
func (c *ChannelFull) GetAbout() (value string) {
	if c == nil {
		return
	}
	return c.About
}

// SetParticipantsCount sets value of ParticipantsCount conditional field.
func (c *ChannelFull) SetParticipantsCount(value int) {
	c.Flags.Set(0)
	c.ParticipantsCount = value
}

// GetParticipantsCount returns value of ParticipantsCount conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetParticipantsCount() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(0) {
		return value, false
	}
	return c.ParticipantsCount, true
}

// SetAdminsCount sets value of AdminsCount conditional field.
func (c *ChannelFull) SetAdminsCount(value int) {
	c.Flags.Set(1)
	c.AdminsCount = value
}

// GetAdminsCount returns value of AdminsCount conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetAdminsCount() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(1) {
		return value, false
	}
	return c.AdminsCount, true
}

// SetKickedCount sets value of KickedCount conditional field.
func (c *ChannelFull) SetKickedCount(value int) {
	c.Flags.Set(2)
	c.KickedCount = value
}

// GetKickedCount returns value of KickedCount conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetKickedCount() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(2) {
		return value, false
	}
	return c.KickedCount, true
}

// SetBannedCount sets value of BannedCount conditional field.
func (c *ChannelFull) SetBannedCount(value int) {
	c.Flags.Set(2)
	c.BannedCount = value
}

// GetBannedCount returns value of BannedCount conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetBannedCount() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(2) {
		return value, false
	}
	return c.BannedCount, true
}

// SetOnlineCount sets value of OnlineCount conditional field.
func (c *ChannelFull) SetOnlineCount(value int) {
	c.Flags.Set(13)
	c.OnlineCount = value
}

// GetOnlineCount returns value of OnlineCount conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetOnlineCount() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(13) {
		return value, false
	}
	return c.OnlineCount, true
}

// GetReadInboxMaxID returns value of ReadInboxMaxID field.
func (c *ChannelFull) GetReadInboxMaxID() (value int) {
	if c == nil {
		return
	}
	return c.ReadInboxMaxID
}

// GetReadOutboxMaxID returns value of ReadOutboxMaxID field.
func (c *ChannelFull) GetReadOutboxMaxID() (value int) {
	if c == nil {
		return
	}
	return c.ReadOutboxMaxID
}

// GetUnreadCount returns value of UnreadCount field.
func (c *ChannelFull) GetUnreadCount() (value int) {
	if c == nil {
		return
	}
	return c.UnreadCount
}

// GetChatPhoto returns value of ChatPhoto field.
func (c *ChannelFull) GetChatPhoto() (value PhotoClass) {
	if c == nil {
		return
	}
	return c.ChatPhoto
}

// GetNotifySettings returns value of NotifySettings field.
func (c *ChannelFull) GetNotifySettings() (value PeerNotifySettings) {
	if c == nil {
		return
	}
	return c.NotifySettings
}

// SetExportedInvite sets value of ExportedInvite conditional field.
func (c *ChannelFull) SetExportedInvite(value ExportedChatInviteClass) {
	c.Flags.Set(23)
	c.ExportedInvite = value
}

// GetExportedInvite returns value of ExportedInvite conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetExportedInvite() (value ExportedChatInviteClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(23) {
		return value, false
	}
	return c.ExportedInvite, true
}

// GetBotInfo returns value of BotInfo field.
func (c *ChannelFull) GetBotInfo() (value []BotInfo) {
	if c == nil {
		return
	}
	return c.BotInfo
}

// SetMigratedFromChatID sets value of MigratedFromChatID conditional field.
func (c *ChannelFull) SetMigratedFromChatID(value int64) {
	c.Flags.Set(4)
	c.MigratedFromChatID = value
}

// GetMigratedFromChatID returns value of MigratedFromChatID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetMigratedFromChatID() (value int64, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(4) {
		return value, false
	}
	return c.MigratedFromChatID, true
}

// SetMigratedFromMaxID sets value of MigratedFromMaxID conditional field.
func (c *ChannelFull) SetMigratedFromMaxID(value int) {
	c.Flags.Set(4)
	c.MigratedFromMaxID = value
}

// GetMigratedFromMaxID returns value of MigratedFromMaxID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetMigratedFromMaxID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(4) {
		return value, false
	}
	return c.MigratedFromMaxID, true
}

// SetPinnedMsgID sets value of PinnedMsgID conditional field.
func (c *ChannelFull) SetPinnedMsgID(value int) {
	c.Flags.Set(5)
	c.PinnedMsgID = value
}

// GetPinnedMsgID returns value of PinnedMsgID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetPinnedMsgID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(5) {
		return value, false
	}
	return c.PinnedMsgID, true
}

// SetStickerset sets value of Stickerset conditional field.
func (c *ChannelFull) SetStickerset(value StickerSet) {
	c.Flags.Set(8)
	c.Stickerset = value
}

// GetStickerset returns value of Stickerset conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetStickerset() (value StickerSet, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(8) {
		return value, false
	}
	return c.Stickerset, true
}

// SetAvailableMinID sets value of AvailableMinID conditional field.
func (c *ChannelFull) SetAvailableMinID(value int) {
	c.Flags.Set(9)
	c.AvailableMinID = value
}

// GetAvailableMinID returns value of AvailableMinID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetAvailableMinID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(9) {
		return value, false
	}
	return c.AvailableMinID, true
}

// SetFolderID sets value of FolderID conditional field.
func (c *ChannelFull) SetFolderID(value int) {
	c.Flags.Set(11)
	c.FolderID = value
}

// GetFolderID returns value of FolderID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetFolderID() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(11) {
		return value, false
	}
	return c.FolderID, true
}

// SetLinkedChatID sets value of LinkedChatID conditional field.
func (c *ChannelFull) SetLinkedChatID(value int64) {
	c.Flags.Set(14)
	c.LinkedChatID = value
}

// GetLinkedChatID returns value of LinkedChatID conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetLinkedChatID() (value int64, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(14) {
		return value, false
	}
	return c.LinkedChatID, true
}

// SetLocation sets value of Location conditional field.
func (c *ChannelFull) SetLocation(value ChannelLocationClass) {
	c.Flags.Set(15)
	c.Location = value
}

// GetLocation returns value of Location conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetLocation() (value ChannelLocationClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(15) {
		return value, false
	}
	return c.Location, true
}

// SetSlowmodeSeconds sets value of SlowmodeSeconds conditional field.
func (c *ChannelFull) SetSlowmodeSeconds(value int) {
	c.Flags.Set(17)
	c.SlowmodeSeconds = value
}

// GetSlowmodeSeconds returns value of SlowmodeSeconds conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetSlowmodeSeconds() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(17) {
		return value, false
	}
	return c.SlowmodeSeconds, true
}

// SetSlowmodeNextSendDate sets value of SlowmodeNextSendDate conditional field.
func (c *ChannelFull) SetSlowmodeNextSendDate(value int) {
	c.Flags.Set(18)
	c.SlowmodeNextSendDate = value
}

// GetSlowmodeNextSendDate returns value of SlowmodeNextSendDate conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetSlowmodeNextSendDate() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(18) {
		return value, false
	}
	return c.SlowmodeNextSendDate, true
}

// SetStatsDC sets value of StatsDC conditional field.
func (c *ChannelFull) SetStatsDC(value int) {
	c.Flags.Set(12)
	c.StatsDC = value
}

// GetStatsDC returns value of StatsDC conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetStatsDC() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(12) {
		return value, false
	}
	return c.StatsDC, true
}

// GetPts returns value of Pts field.
func (c *ChannelFull) GetPts() (value int) {
	if c == nil {
		return
	}
	return c.Pts
}

// SetCall sets value of Call conditional field.
func (c *ChannelFull) SetCall(value InputGroupCall) {
	c.Flags.Set(21)
	c.Call = value
}

// GetCall returns value of Call conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetCall() (value InputGroupCall, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(21) {
		return value, false
	}
	return c.Call, true
}

// SetTTLPeriod sets value of TTLPeriod conditional field.
func (c *ChannelFull) SetTTLPeriod(value int) {
	c.Flags.Set(24)
	c.TTLPeriod = value
}

// GetTTLPeriod returns value of TTLPeriod conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetTTLPeriod() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(24) {
		return value, false
	}
	return c.TTLPeriod, true
}

// SetPendingSuggestions sets value of PendingSuggestions conditional field.
func (c *ChannelFull) SetPendingSuggestions(value []string) {
	c.Flags.Set(25)
	c.PendingSuggestions = value
}

// GetPendingSuggestions returns value of PendingSuggestions conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetPendingSuggestions() (value []string, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(25) {
		return value, false
	}
	return c.PendingSuggestions, true
}

// SetGroupcallDefaultJoinAs sets value of GroupcallDefaultJoinAs conditional field.
func (c *ChannelFull) SetGroupcallDefaultJoinAs(value PeerClass) {
	c.Flags.Set(26)
	c.GroupcallDefaultJoinAs = value
}

// GetGroupcallDefaultJoinAs returns value of GroupcallDefaultJoinAs conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(26) {
		return value, false
	}
	return c.GroupcallDefaultJoinAs, true
}

// SetThemeEmoticon sets value of ThemeEmoticon conditional field.
func (c *ChannelFull) SetThemeEmoticon(value string) {
	c.Flags.Set(27)
	c.ThemeEmoticon = value
}

// GetThemeEmoticon returns value of ThemeEmoticon conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetThemeEmoticon() (value string, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(27) {
		return value, false
	}
	return c.ThemeEmoticon, true
}

// SetRequestsPending sets value of RequestsPending conditional field.
func (c *ChannelFull) SetRequestsPending(value int) {
	c.Flags.Set(28)
	c.RequestsPending = value
}

// GetRequestsPending returns value of RequestsPending conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetRequestsPending() (value int, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(28) {
		return value, false
	}
	return c.RequestsPending, true
}

// SetRecentRequesters sets value of RecentRequesters conditional field.
func (c *ChannelFull) SetRecentRequesters(value []int64) {
	c.Flags.Set(28)
	c.RecentRequesters = value
}

// GetRecentRequesters returns value of RecentRequesters conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetRecentRequesters() (value []int64, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(28) {
		return value, false
	}
	return c.RecentRequesters, true
}

// SetDefaultSendAs sets value of DefaultSendAs conditional field.
func (c *ChannelFull) SetDefaultSendAs(value PeerClass) {
	c.Flags.Set(29)
	c.DefaultSendAs = value
}

// GetDefaultSendAs returns value of DefaultSendAs conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetDefaultSendAs() (value PeerClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(29) {
		return value, false
	}
	return c.DefaultSendAs, true
}

// SetAvailableReactions sets value of AvailableReactions conditional field.
func (c *ChannelFull) SetAvailableReactions(value ChatReactionsClass) {
	c.Flags.Set(30)
	c.AvailableReactions = value
}

// GetAvailableReactions returns value of AvailableReactions conditional field and
// boolean which is true if field was set.
func (c *ChannelFull) GetAvailableReactions() (value ChatReactionsClass, ok bool) {
	if c == nil {
		return
	}
	if !c.Flags.Has(30) {
		return value, false
	}
	return c.AvailableReactions, true
}

// ChatFullClassName is schema name of ChatFullClass.
const ChatFullClassName = "ChatFull"

// ChatFullClass represents ChatFull generic type.
//
// See https://core.telegram.org/type/ChatFull for reference.
//
// Example:
//
//	g, err := tg.DecodeChatFull(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.ChatFull: // chatFull#c9d31138
//	case *tg.ChannelFull: // channelFull#f2355507
//	default: panic(v)
//	}
type ChatFullClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() ChatFullClass

	// 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

	// Can we change the username of this chat
	GetCanSetUsername() (value bool)

	// Whether scheduled messages¹ are available
	//
	// Links:
	//  1) https://core.telegram.org/api/scheduled-messages
	GetHasScheduled() (value bool)

	// Whether the real-time chat translation popup¹ should be hidden.
	//
	// Links:
	//  1) https://core.telegram.org/api/translation
	GetTranslationsDisabled() (value bool)

	// ID of the chat
	GetID() (value int64)

	// About string for this chat
	GetAbout() (value string)

	// Notification settings
	GetNotifySettings() (value PeerNotifySettings)

	// Chat invite
	GetExportedInvite() (value ExportedChatInviteClass, ok bool)

	// Message ID of the last pinned message¹
	//
	// Links:
	//  1) https://core.telegram.org/api/pin
	GetPinnedMsgID() (value int, ok bool)

	// Peer folder ID, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/folders#peer-folders
	GetFolderID() (value int, ok bool)

	// Group call information
	GetCall() (value InputGroupCall, ok bool)

	// Time-To-Live of messages sent by the current user to this chat
	GetTTLPeriod() (value int, ok bool)

	// When using phone.getGroupCallJoinAs¹ to get a list of peers that can be used to join
	// a group call, this field indicates the peer that should be selected by default.
	//
	// Links:
	//  1) https://core.telegram.org/method/phone.getGroupCallJoinAs
	GetGroupcallDefaultJoinAs() (value PeerClass, ok bool)

	// Emoji representing a specific chat theme
	GetThemeEmoticon() (value string, ok bool)

	// Pending join requests »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	GetRequestsPending() (value int, ok bool)

	// IDs of users who requested to join recently
	GetRecentRequesters() (value []int64, ok bool)
	// Allowed message reactions »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/reactions
	GetAvailableReactions() (value ChatReactionsClass, ok bool)
}

// DecodeChatFull implements binary de-serialization for ChatFullClass.
func DecodeChatFull(buf *bin.Buffer) (ChatFullClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case ChatFullTypeID:
		// Decoding chatFull#c9d31138.
		v := ChatFull{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err)
		}
		return &v, nil
	case ChannelFullTypeID:
		// Decoding channelFull#f2355507.
		v := ChannelFull{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode ChatFullClass: %w", bin.NewUnexpectedID(id))
	}
}

// ChatFull boxes the ChatFullClass providing a helper.
type ChatFullBox struct {
	ChatFull ChatFullClass
}

// Decode implements bin.Decoder for ChatFullBox.
func (b *ChatFullBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode ChatFullBox to nil")
	}
	v, err := DecodeChatFull(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.ChatFull = v
	return nil
}

// Encode implements bin.Encode for ChatFullBox.
func (b *ChatFullBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.ChatFull == nil {
		return fmt.Errorf("unable to encode ChatFullClass as nil")
	}
	return b.ChatFull.Encode(buf)
}
