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

// Config represents TL type `config#cc1a241e`.
// Current configuration
//
// See https://core.telegram.org/constructor/config for reference.
type Config struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the client should use P2P by default for phone calls with contacts
	DefaultP2PContacts bool
	// Whether the client should preload featured stickers
	PreloadFeaturedStickers bool
	// Whether incoming private messages can be deleted for both participants
	RevokePmInbox bool
	// Indicates that telegram is probably censored by governments/ISPs in the current region
	BlockedMode bool
	// Whether to forcefully connect using IPv6 dcOptions¹, even if the client knows that
	// IPv4 is available.
	//
	// Links:
	//  1) https://core.telegram.org/type/DcOption
	ForceTryIpv6 bool
	// Current date at the server
	Date int
	// Expiration date of this config: when it expires it'll have to be refetched using help
	// getConfig¹
	//
	// Links:
	//  1) https://core.telegram.org/method/help.getConfig
	Expires int
	// Whether we're connected to the test DCs
	TestMode bool
	// ID of the DC that returned the reply
	ThisDC int
	// DC IP list
	DCOptions []DCOption
	// Domain name for fetching encrypted DC list from DNS TXT record
	DCTxtDomainName string
	// Maximum member count for normal groups¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	ChatSizeMax int
	// Maximum member count for supergroups¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	MegagroupSizeMax int
	// Maximum number of messages that can be forwarded at once using messages
	// forwardMessages¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.forwardMessages
	ForwardedCountMax int
	// The client should update its online status¹ every N milliseconds
	//
	// Links:
	//  1) https://core.telegram.org/method/account.updateStatus
	OnlineUpdatePeriodMs int
	// Delay before offline status needs to be sent to the server
	OfflineBlurTimeoutMs int
	// Time without any user activity after which it should be treated offline
	OfflineIdleTimeoutMs int
	// If we are offline, but were online from some other client in last
	// online_cloud_timeout_ms milliseconds after we had gone offline, then delay offline
	// notification for notify_cloud_delay_ms milliseconds.
	OnlineCloudTimeoutMs int
	// If we are offline, but online from some other client then delay sending the offline
	// notification for notify_cloud_delay_ms milliseconds.
	NotifyCloudDelayMs int
	// If some other client is online, then delay notification for
	// notification_default_delay_ms milliseconds
	NotifyDefaultDelayMs int
	// Not for client use
	PushChatPeriodMs int
	// Not for client use
	PushChatLimit int
	// Only messages with age smaller than the one specified can be edited
	EditTimeLimit int
	// Only channel/supergroup messages with age smaller than the specified can be deleted
	RevokeTimeLimit int
	// Only private messages with age smaller than the specified can be deleted
	RevokePmTimeLimit int
	// Exponential decay rate for computing top peer rating¹
	//
	// Links:
	//  1) https://core.telegram.org/api/top-rating
	RatingEDecay int
	// Maximum number of recent stickers
	StickersRecentLimit int
	// Indicates that round videos (video notes) and voice messages sent in channels and
	// older than the specified period must be marked as read
	ChannelsReadMediaPeriod int
	// Temporary passport¹ sessions
	//
	// Links:
	//  1) https://core.telegram.org/passport
	//
	// Use SetTmpSessions and GetTmpSessions helpers.
	TmpSessions int
	// Maximum allowed outgoing ring time in VoIP calls: if the user we're calling doesn't
	// reply within the specified time (in milliseconds), we should hang up the call
	CallReceiveTimeoutMs int
	// Maximum allowed incoming ring time in VoIP calls: if the current user doesn't reply
	// within the specified time (in milliseconds), the call will be automatically refused
	CallRingTimeoutMs int
	// VoIP connection timeout: if the instance of libtgvoip on the other side of the call
	// doesn't connect to our instance of libtgvoip within the specified time (in
	// milliseconds), the call must be aborted
	CallConnectTimeoutMs int
	// If during a VoIP call a packet isn't received for the specified period of time, the
	// call must be aborted
	CallPacketTimeoutMs int
	// The domain to use to parse deep links »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links
	MeURLPrefix string
	// URL to use to auto-update the current app
	//
	// Use SetAutoupdateURLPrefix and GetAutoupdateURLPrefix helpers.
	AutoupdateURLPrefix string
	// Username of the bot to use to search for GIFs
	//
	// Use SetGifSearchUsername and GetGifSearchUsername helpers.
	GifSearchUsername string
	// Username of the bot to use to search for venues
	//
	// Use SetVenueSearchUsername and GetVenueSearchUsername helpers.
	VenueSearchUsername string
	// Username of the bot to use for image search
	//
	// Use SetImgSearchUsername and GetImgSearchUsername helpers.
	ImgSearchUsername string
	// ID of the map provider to use for venues
	//
	// Use SetStaticMapsProvider and GetStaticMapsProvider helpers.
	StaticMapsProvider string
	// Maximum length of caption (length in utf8 codepoints)
	CaptionLengthMax int
	// Maximum length of messages (length in utf8 codepoints)
	MessageLengthMax int
	// DC ID to use to download webfiles¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#downloading-webfiles
	WebfileDCID int
	// Suggested language code
	//
	// Use SetSuggestedLangCode and GetSuggestedLangCode helpers.
	SuggestedLangCode string
	// Language pack version
	//
	// Use SetLangPackVersion and GetLangPackVersion helpers.
	LangPackVersion int
	// Basic language pack version
	//
	// Use SetBaseLangPackVersion and GetBaseLangPackVersion helpers.
	BaseLangPackVersion int
	// Default message reaction¹
	//
	// Links:
	//  1) https://core.telegram.org/api/reactions
	//
	// Use SetReactionsDefault and GetReactionsDefault helpers.
	ReactionsDefault ReactionClass
	// Autologin token, click here for more info on URL authorization »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/url-authorization#link-url-authorization
	//
	// Use SetAutologinToken and GetAutologinToken helpers.
	AutologinToken string
}

// ConfigTypeID is TL type id of Config.
const ConfigTypeID = 0xcc1a241e

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

func (c *Config) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Flags.Zero()) {
		return false
	}
	if !(c.DefaultP2PContacts == false) {
		return false
	}
	if !(c.PreloadFeaturedStickers == false) {
		return false
	}
	if !(c.RevokePmInbox == false) {
		return false
	}
	if !(c.BlockedMode == false) {
		return false
	}
	if !(c.ForceTryIpv6 == false) {
		return false
	}
	if !(c.Date == 0) {
		return false
	}
	if !(c.Expires == 0) {
		return false
	}
	if !(c.TestMode == false) {
		return false
	}
	if !(c.ThisDC == 0) {
		return false
	}
	if !(c.DCOptions == nil) {
		return false
	}
	if !(c.DCTxtDomainName == "") {
		return false
	}
	if !(c.ChatSizeMax == 0) {
		return false
	}
	if !(c.MegagroupSizeMax == 0) {
		return false
	}
	if !(c.ForwardedCountMax == 0) {
		return false
	}
	if !(c.OnlineUpdatePeriodMs == 0) {
		return false
	}
	if !(c.OfflineBlurTimeoutMs == 0) {
		return false
	}
	if !(c.OfflineIdleTimeoutMs == 0) {
		return false
	}
	if !(c.OnlineCloudTimeoutMs == 0) {
		return false
	}
	if !(c.NotifyCloudDelayMs == 0) {
		return false
	}
	if !(c.NotifyDefaultDelayMs == 0) {
		return false
	}
	if !(c.PushChatPeriodMs == 0) {
		return false
	}
	if !(c.PushChatLimit == 0) {
		return false
	}
	if !(c.EditTimeLimit == 0) {
		return false
	}
	if !(c.RevokeTimeLimit == 0) {
		return false
	}
	if !(c.RevokePmTimeLimit == 0) {
		return false
	}
	if !(c.RatingEDecay == 0) {
		return false
	}
	if !(c.StickersRecentLimit == 0) {
		return false
	}
	if !(c.ChannelsReadMediaPeriod == 0) {
		return false
	}
	if !(c.TmpSessions == 0) {
		return false
	}
	if !(c.CallReceiveTimeoutMs == 0) {
		return false
	}
	if !(c.CallRingTimeoutMs == 0) {
		return false
	}
	if !(c.CallConnectTimeoutMs == 0) {
		return false
	}
	if !(c.CallPacketTimeoutMs == 0) {
		return false
	}
	if !(c.MeURLPrefix == "") {
		return false
	}
	if !(c.AutoupdateURLPrefix == "") {
		return false
	}
	if !(c.GifSearchUsername == "") {
		return false
	}
	if !(c.VenueSearchUsername == "") {
		return false
	}
	if !(c.ImgSearchUsername == "") {
		return false
	}
	if !(c.StaticMapsProvider == "") {
		return false
	}
	if !(c.CaptionLengthMax == 0) {
		return false
	}
	if !(c.MessageLengthMax == 0) {
		return false
	}
	if !(c.WebfileDCID == 0) {
		return false
	}
	if !(c.SuggestedLangCode == "") {
		return false
	}
	if !(c.LangPackVersion == 0) {
		return false
	}
	if !(c.BaseLangPackVersion == 0) {
		return false
	}
	if !(c.ReactionsDefault == nil) {
		return false
	}
	if !(c.AutologinToken == "") {
		return false
	}

	return true
}

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

// FillFrom fills Config from given interface.
func (c *Config) FillFrom(from interface {
	GetDefaultP2PContacts() (value bool)
	GetPreloadFeaturedStickers() (value bool)
	GetRevokePmInbox() (value bool)
	GetBlockedMode() (value bool)
	GetForceTryIpv6() (value bool)
	GetDate() (value int)
	GetExpires() (value int)
	GetTestMode() (value bool)
	GetThisDC() (value int)
	GetDCOptions() (value []DCOption)
	GetDCTxtDomainName() (value string)
	GetChatSizeMax() (value int)
	GetMegagroupSizeMax() (value int)
	GetForwardedCountMax() (value int)
	GetOnlineUpdatePeriodMs() (value int)
	GetOfflineBlurTimeoutMs() (value int)
	GetOfflineIdleTimeoutMs() (value int)
	GetOnlineCloudTimeoutMs() (value int)
	GetNotifyCloudDelayMs() (value int)
	GetNotifyDefaultDelayMs() (value int)
	GetPushChatPeriodMs() (value int)
	GetPushChatLimit() (value int)
	GetEditTimeLimit() (value int)
	GetRevokeTimeLimit() (value int)
	GetRevokePmTimeLimit() (value int)
	GetRatingEDecay() (value int)
	GetStickersRecentLimit() (value int)
	GetChannelsReadMediaPeriod() (value int)
	GetTmpSessions() (value int, ok bool)
	GetCallReceiveTimeoutMs() (value int)
	GetCallRingTimeoutMs() (value int)
	GetCallConnectTimeoutMs() (value int)
	GetCallPacketTimeoutMs() (value int)
	GetMeURLPrefix() (value string)
	GetAutoupdateURLPrefix() (value string, ok bool)
	GetGifSearchUsername() (value string, ok bool)
	GetVenueSearchUsername() (value string, ok bool)
	GetImgSearchUsername() (value string, ok bool)
	GetStaticMapsProvider() (value string, ok bool)
	GetCaptionLengthMax() (value int)
	GetMessageLengthMax() (value int)
	GetWebfileDCID() (value int)
	GetSuggestedLangCode() (value string, ok bool)
	GetLangPackVersion() (value int, ok bool)
	GetBaseLangPackVersion() (value int, ok bool)
	GetReactionsDefault() (value ReactionClass, ok bool)
	GetAutologinToken() (value string, ok bool)
}) {
	c.DefaultP2PContacts = from.GetDefaultP2PContacts()
	c.PreloadFeaturedStickers = from.GetPreloadFeaturedStickers()
	c.RevokePmInbox = from.GetRevokePmInbox()
	c.BlockedMode = from.GetBlockedMode()
	c.ForceTryIpv6 = from.GetForceTryIpv6()
	c.Date = from.GetDate()
	c.Expires = from.GetExpires()
	c.TestMode = from.GetTestMode()
	c.ThisDC = from.GetThisDC()
	c.DCOptions = from.GetDCOptions()
	c.DCTxtDomainName = from.GetDCTxtDomainName()
	c.ChatSizeMax = from.GetChatSizeMax()
	c.MegagroupSizeMax = from.GetMegagroupSizeMax()
	c.ForwardedCountMax = from.GetForwardedCountMax()
	c.OnlineUpdatePeriodMs = from.GetOnlineUpdatePeriodMs()
	c.OfflineBlurTimeoutMs = from.GetOfflineBlurTimeoutMs()
	c.OfflineIdleTimeoutMs = from.GetOfflineIdleTimeoutMs()
	c.OnlineCloudTimeoutMs = from.GetOnlineCloudTimeoutMs()
	c.NotifyCloudDelayMs = from.GetNotifyCloudDelayMs()
	c.NotifyDefaultDelayMs = from.GetNotifyDefaultDelayMs()
	c.PushChatPeriodMs = from.GetPushChatPeriodMs()
	c.PushChatLimit = from.GetPushChatLimit()
	c.EditTimeLimit = from.GetEditTimeLimit()
	c.RevokeTimeLimit = from.GetRevokeTimeLimit()
	c.RevokePmTimeLimit = from.GetRevokePmTimeLimit()
	c.RatingEDecay = from.GetRatingEDecay()
	c.StickersRecentLimit = from.GetStickersRecentLimit()
	c.ChannelsReadMediaPeriod = from.GetChannelsReadMediaPeriod()
	if val, ok := from.GetTmpSessions(); ok {
		c.TmpSessions = val
	}

	c.CallReceiveTimeoutMs = from.GetCallReceiveTimeoutMs()
	c.CallRingTimeoutMs = from.GetCallRingTimeoutMs()
	c.CallConnectTimeoutMs = from.GetCallConnectTimeoutMs()
	c.CallPacketTimeoutMs = from.GetCallPacketTimeoutMs()
	c.MeURLPrefix = from.GetMeURLPrefix()
	if val, ok := from.GetAutoupdateURLPrefix(); ok {
		c.AutoupdateURLPrefix = val
	}

	if val, ok := from.GetGifSearchUsername(); ok {
		c.GifSearchUsername = val
	}

	if val, ok := from.GetVenueSearchUsername(); ok {
		c.VenueSearchUsername = val
	}

	if val, ok := from.GetImgSearchUsername(); ok {
		c.ImgSearchUsername = val
	}

	if val, ok := from.GetStaticMapsProvider(); ok {
		c.StaticMapsProvider = val
	}

	c.CaptionLengthMax = from.GetCaptionLengthMax()
	c.MessageLengthMax = from.GetMessageLengthMax()
	c.WebfileDCID = from.GetWebfileDCID()
	if val, ok := from.GetSuggestedLangCode(); ok {
		c.SuggestedLangCode = val
	}

	if val, ok := from.GetLangPackVersion(); ok {
		c.LangPackVersion = val
	}

	if val, ok := from.GetBaseLangPackVersion(); ok {
		c.BaseLangPackVersion = val
	}

	if val, ok := from.GetReactionsDefault(); ok {
		c.ReactionsDefault = val
	}

	if val, ok := from.GetAutologinToken(); ok {
		c.AutologinToken = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (c *Config) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "config",
		ID:   ConfigTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "DefaultP2PContacts",
			SchemaName: "default_p2p_contacts",
			Null:       !c.Flags.Has(3),
		},
		{
			Name:       "PreloadFeaturedStickers",
			SchemaName: "preload_featured_stickers",
			Null:       !c.Flags.Has(4),
		},
		{
			Name:       "RevokePmInbox",
			SchemaName: "revoke_pm_inbox",
			Null:       !c.Flags.Has(6),
		},
		{
			Name:       "BlockedMode",
			SchemaName: "blocked_mode",
			Null:       !c.Flags.Has(8),
		},
		{
			Name:       "ForceTryIpv6",
			SchemaName: "force_try_ipv6",
			Null:       !c.Flags.Has(14),
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
		{
			Name:       "TestMode",
			SchemaName: "test_mode",
		},
		{
			Name:       "ThisDC",
			SchemaName: "this_dc",
		},
		{
			Name:       "DCOptions",
			SchemaName: "dc_options",
		},
		{
			Name:       "DCTxtDomainName",
			SchemaName: "dc_txt_domain_name",
		},
		{
			Name:       "ChatSizeMax",
			SchemaName: "chat_size_max",
		},
		{
			Name:       "MegagroupSizeMax",
			SchemaName: "megagroup_size_max",
		},
		{
			Name:       "ForwardedCountMax",
			SchemaName: "forwarded_count_max",
		},
		{
			Name:       "OnlineUpdatePeriodMs",
			SchemaName: "online_update_period_ms",
		},
		{
			Name:       "OfflineBlurTimeoutMs",
			SchemaName: "offline_blur_timeout_ms",
		},
		{
			Name:       "OfflineIdleTimeoutMs",
			SchemaName: "offline_idle_timeout_ms",
		},
		{
			Name:       "OnlineCloudTimeoutMs",
			SchemaName: "online_cloud_timeout_ms",
		},
		{
			Name:       "NotifyCloudDelayMs",
			SchemaName: "notify_cloud_delay_ms",
		},
		{
			Name:       "NotifyDefaultDelayMs",
			SchemaName: "notify_default_delay_ms",
		},
		{
			Name:       "PushChatPeriodMs",
			SchemaName: "push_chat_period_ms",
		},
		{
			Name:       "PushChatLimit",
			SchemaName: "push_chat_limit",
		},
		{
			Name:       "EditTimeLimit",
			SchemaName: "edit_time_limit",
		},
		{
			Name:       "RevokeTimeLimit",
			SchemaName: "revoke_time_limit",
		},
		{
			Name:       "RevokePmTimeLimit",
			SchemaName: "revoke_pm_time_limit",
		},
		{
			Name:       "RatingEDecay",
			SchemaName: "rating_e_decay",
		},
		{
			Name:       "StickersRecentLimit",
			SchemaName: "stickers_recent_limit",
		},
		{
			Name:       "ChannelsReadMediaPeriod",
			SchemaName: "channels_read_media_period",
		},
		{
			Name:       "TmpSessions",
			SchemaName: "tmp_sessions",
			Null:       !c.Flags.Has(0),
		},
		{
			Name:       "CallReceiveTimeoutMs",
			SchemaName: "call_receive_timeout_ms",
		},
		{
			Name:       "CallRingTimeoutMs",
			SchemaName: "call_ring_timeout_ms",
		},
		{
			Name:       "CallConnectTimeoutMs",
			SchemaName: "call_connect_timeout_ms",
		},
		{
			Name:       "CallPacketTimeoutMs",
			SchemaName: "call_packet_timeout_ms",
		},
		{
			Name:       "MeURLPrefix",
			SchemaName: "me_url_prefix",
		},
		{
			Name:       "AutoupdateURLPrefix",
			SchemaName: "autoupdate_url_prefix",
			Null:       !c.Flags.Has(7),
		},
		{
			Name:       "GifSearchUsername",
			SchemaName: "gif_search_username",
			Null:       !c.Flags.Has(9),
		},
		{
			Name:       "VenueSearchUsername",
			SchemaName: "venue_search_username",
			Null:       !c.Flags.Has(10),
		},
		{
			Name:       "ImgSearchUsername",
			SchemaName: "img_search_username",
			Null:       !c.Flags.Has(11),
		},
		{
			Name:       "StaticMapsProvider",
			SchemaName: "static_maps_provider",
			Null:       !c.Flags.Has(12),
		},
		{
			Name:       "CaptionLengthMax",
			SchemaName: "caption_length_max",
		},
		{
			Name:       "MessageLengthMax",
			SchemaName: "message_length_max",
		},
		{
			Name:       "WebfileDCID",
			SchemaName: "webfile_dc_id",
		},
		{
			Name:       "SuggestedLangCode",
			SchemaName: "suggested_lang_code",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "LangPackVersion",
			SchemaName: "lang_pack_version",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "BaseLangPackVersion",
			SchemaName: "base_lang_pack_version",
			Null:       !c.Flags.Has(2),
		},
		{
			Name:       "ReactionsDefault",
			SchemaName: "reactions_default",
			Null:       !c.Flags.Has(15),
		},
		{
			Name:       "AutologinToken",
			SchemaName: "autologin_token",
			Null:       !c.Flags.Has(16),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (c *Config) SetFlags() {
	if !(c.DefaultP2PContacts == false) {
		c.Flags.Set(3)
	}
	if !(c.PreloadFeaturedStickers == false) {
		c.Flags.Set(4)
	}
	if !(c.RevokePmInbox == false) {
		c.Flags.Set(6)
	}
	if !(c.BlockedMode == false) {
		c.Flags.Set(8)
	}
	if !(c.ForceTryIpv6 == false) {
		c.Flags.Set(14)
	}
	if !(c.TmpSessions == 0) {
		c.Flags.Set(0)
	}
	if !(c.AutoupdateURLPrefix == "") {
		c.Flags.Set(7)
	}
	if !(c.GifSearchUsername == "") {
		c.Flags.Set(9)
	}
	if !(c.VenueSearchUsername == "") {
		c.Flags.Set(10)
	}
	if !(c.ImgSearchUsername == "") {
		c.Flags.Set(11)
	}
	if !(c.StaticMapsProvider == "") {
		c.Flags.Set(12)
	}
	if !(c.SuggestedLangCode == "") {
		c.Flags.Set(2)
	}
	if !(c.LangPackVersion == 0) {
		c.Flags.Set(2)
	}
	if !(c.BaseLangPackVersion == 0) {
		c.Flags.Set(2)
	}
	if !(c.ReactionsDefault == nil) {
		c.Flags.Set(15)
	}
	if !(c.AutologinToken == "") {
		c.Flags.Set(16)
	}
}

// Encode implements bin.Encoder.
func (c *Config) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode config#cc1a241e as nil")
	}
	b.PutID(ConfigTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *Config) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode config#cc1a241e as nil")
	}
	c.SetFlags()
	if err := c.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode config#cc1a241e: field flags: %w", err)
	}
	b.PutInt(c.Date)
	b.PutInt(c.Expires)
	b.PutBool(c.TestMode)
	b.PutInt(c.ThisDC)
	b.PutVectorHeader(len(c.DCOptions))
	for idx, v := range c.DCOptions {
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode config#cc1a241e: field dc_options element with index %d: %w", idx, err)
		}
	}
	b.PutString(c.DCTxtDomainName)
	b.PutInt(c.ChatSizeMax)
	b.PutInt(c.MegagroupSizeMax)
	b.PutInt(c.ForwardedCountMax)
	b.PutInt(c.OnlineUpdatePeriodMs)
	b.PutInt(c.OfflineBlurTimeoutMs)
	b.PutInt(c.OfflineIdleTimeoutMs)
	b.PutInt(c.OnlineCloudTimeoutMs)
	b.PutInt(c.NotifyCloudDelayMs)
	b.PutInt(c.NotifyDefaultDelayMs)
	b.PutInt(c.PushChatPeriodMs)
	b.PutInt(c.PushChatLimit)
	b.PutInt(c.EditTimeLimit)
	b.PutInt(c.RevokeTimeLimit)
	b.PutInt(c.RevokePmTimeLimit)
	b.PutInt(c.RatingEDecay)
	b.PutInt(c.StickersRecentLimit)
	b.PutInt(c.ChannelsReadMediaPeriod)
	if c.Flags.Has(0) {
		b.PutInt(c.TmpSessions)
	}
	b.PutInt(c.CallReceiveTimeoutMs)
	b.PutInt(c.CallRingTimeoutMs)
	b.PutInt(c.CallConnectTimeoutMs)
	b.PutInt(c.CallPacketTimeoutMs)
	b.PutString(c.MeURLPrefix)
	if c.Flags.Has(7) {
		b.PutString(c.AutoupdateURLPrefix)
	}
	if c.Flags.Has(9) {
		b.PutString(c.GifSearchUsername)
	}
	if c.Flags.Has(10) {
		b.PutString(c.VenueSearchUsername)
	}
	if c.Flags.Has(11) {
		b.PutString(c.ImgSearchUsername)
	}
	if c.Flags.Has(12) {
		b.PutString(c.StaticMapsProvider)
	}
	b.PutInt(c.CaptionLengthMax)
	b.PutInt(c.MessageLengthMax)
	b.PutInt(c.WebfileDCID)
	if c.Flags.Has(2) {
		b.PutString(c.SuggestedLangCode)
	}
	if c.Flags.Has(2) {
		b.PutInt(c.LangPackVersion)
	}
	if c.Flags.Has(2) {
		b.PutInt(c.BaseLangPackVersion)
	}
	if c.Flags.Has(15) {
		if c.ReactionsDefault == nil {
			return fmt.Errorf("unable to encode config#cc1a241e: field reactions_default is nil")
		}
		if err := c.ReactionsDefault.Encode(b); err != nil {
			return fmt.Errorf("unable to encode config#cc1a241e: field reactions_default: %w", err)
		}
	}
	if c.Flags.Has(16) {
		b.PutString(c.AutologinToken)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (c *Config) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode config#cc1a241e to nil")
	}
	{
		if err := c.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field flags: %w", err)
		}
	}
	c.DefaultP2PContacts = c.Flags.Has(3)
	c.PreloadFeaturedStickers = c.Flags.Has(4)
	c.RevokePmInbox = c.Flags.Has(6)
	c.BlockedMode = c.Flags.Has(8)
	c.ForceTryIpv6 = c.Flags.Has(14)
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field date: %w", err)
		}
		c.Date = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field expires: %w", err)
		}
		c.Expires = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field test_mode: %w", err)
		}
		c.TestMode = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field this_dc: %w", err)
		}
		c.ThisDC = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field dc_options: %w", err)
		}

		if headerLen > 0 {
			c.DCOptions = make([]DCOption, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			var value DCOption
			if err := value.Decode(b); err != nil {
				return fmt.Errorf("unable to decode config#cc1a241e: field dc_options: %w", err)
			}
			c.DCOptions = append(c.DCOptions, value)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field dc_txt_domain_name: %w", err)
		}
		c.DCTxtDomainName = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field chat_size_max: %w", err)
		}
		c.ChatSizeMax = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field megagroup_size_max: %w", err)
		}
		c.MegagroupSizeMax = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field forwarded_count_max: %w", err)
		}
		c.ForwardedCountMax = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field online_update_period_ms: %w", err)
		}
		c.OnlineUpdatePeriodMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field offline_blur_timeout_ms: %w", err)
		}
		c.OfflineBlurTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field offline_idle_timeout_ms: %w", err)
		}
		c.OfflineIdleTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field online_cloud_timeout_ms: %w", err)
		}
		c.OnlineCloudTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field notify_cloud_delay_ms: %w", err)
		}
		c.NotifyCloudDelayMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field notify_default_delay_ms: %w", err)
		}
		c.NotifyDefaultDelayMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field push_chat_period_ms: %w", err)
		}
		c.PushChatPeriodMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field push_chat_limit: %w", err)
		}
		c.PushChatLimit = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field edit_time_limit: %w", err)
		}
		c.EditTimeLimit = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field revoke_time_limit: %w", err)
		}
		c.RevokeTimeLimit = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field revoke_pm_time_limit: %w", err)
		}
		c.RevokePmTimeLimit = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field rating_e_decay: %w", err)
		}
		c.RatingEDecay = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field stickers_recent_limit: %w", err)
		}
		c.StickersRecentLimit = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field channels_read_media_period: %w", err)
		}
		c.ChannelsReadMediaPeriod = value
	}
	if c.Flags.Has(0) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field tmp_sessions: %w", err)
		}
		c.TmpSessions = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field call_receive_timeout_ms: %w", err)
		}
		c.CallReceiveTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field call_ring_timeout_ms: %w", err)
		}
		c.CallRingTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field call_connect_timeout_ms: %w", err)
		}
		c.CallConnectTimeoutMs = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field call_packet_timeout_ms: %w", err)
		}
		c.CallPacketTimeoutMs = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field me_url_prefix: %w", err)
		}
		c.MeURLPrefix = value
	}
	if c.Flags.Has(7) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field autoupdate_url_prefix: %w", err)
		}
		c.AutoupdateURLPrefix = value
	}
	if c.Flags.Has(9) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field gif_search_username: %w", err)
		}
		c.GifSearchUsername = value
	}
	if c.Flags.Has(10) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field venue_search_username: %w", err)
		}
		c.VenueSearchUsername = value
	}
	if c.Flags.Has(11) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field img_search_username: %w", err)
		}
		c.ImgSearchUsername = value
	}
	if c.Flags.Has(12) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field static_maps_provider: %w", err)
		}
		c.StaticMapsProvider = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field caption_length_max: %w", err)
		}
		c.CaptionLengthMax = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field message_length_max: %w", err)
		}
		c.MessageLengthMax = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field webfile_dc_id: %w", err)
		}
		c.WebfileDCID = value
	}
	if c.Flags.Has(2) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field suggested_lang_code: %w", err)
		}
		c.SuggestedLangCode = value
	}
	if c.Flags.Has(2) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field lang_pack_version: %w", err)
		}
		c.LangPackVersion = value
	}
	if c.Flags.Has(2) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field base_lang_pack_version: %w", err)
		}
		c.BaseLangPackVersion = value
	}
	if c.Flags.Has(15) {
		value, err := DecodeReaction(b)
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field reactions_default: %w", err)
		}
		c.ReactionsDefault = value
	}
	if c.Flags.Has(16) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode config#cc1a241e: field autologin_token: %w", err)
		}
		c.AutologinToken = value
	}
	return nil
}

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

// GetDefaultP2PContacts returns value of DefaultP2PContacts conditional field.
func (c *Config) GetDefaultP2PContacts() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(3)
}

// SetPreloadFeaturedStickers sets value of PreloadFeaturedStickers conditional field.
func (c *Config) SetPreloadFeaturedStickers(value bool) {
	if value {
		c.Flags.Set(4)
		c.PreloadFeaturedStickers = true
	} else {
		c.Flags.Unset(4)
		c.PreloadFeaturedStickers = false
	}
}

// GetPreloadFeaturedStickers returns value of PreloadFeaturedStickers conditional field.
func (c *Config) GetPreloadFeaturedStickers() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(4)
}

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

// GetRevokePmInbox returns value of RevokePmInbox conditional field.
func (c *Config) GetRevokePmInbox() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(6)
}

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

// GetBlockedMode returns value of BlockedMode conditional field.
func (c *Config) GetBlockedMode() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(8)
}

// SetForceTryIpv6 sets value of ForceTryIpv6 conditional field.
func (c *Config) SetForceTryIpv6(value bool) {
	if value {
		c.Flags.Set(14)
		c.ForceTryIpv6 = true
	} else {
		c.Flags.Unset(14)
		c.ForceTryIpv6 = false
	}
}

// GetForceTryIpv6 returns value of ForceTryIpv6 conditional field.
func (c *Config) GetForceTryIpv6() (value bool) {
	if c == nil {
		return
	}
	return c.Flags.Has(14)
}

// GetDate returns value of Date field.
func (c *Config) GetDate() (value int) {
	if c == nil {
		return
	}
	return c.Date
}

// GetExpires returns value of Expires field.
func (c *Config) GetExpires() (value int) {
	if c == nil {
		return
	}
	return c.Expires
}

// GetTestMode returns value of TestMode field.
func (c *Config) GetTestMode() (value bool) {
	if c == nil {
		return
	}
	return c.TestMode
}

// GetThisDC returns value of ThisDC field.
func (c *Config) GetThisDC() (value int) {
	if c == nil {
		return
	}
	return c.ThisDC
}

// GetDCOptions returns value of DCOptions field.
func (c *Config) GetDCOptions() (value []DCOption) {
	if c == nil {
		return
	}
	return c.DCOptions
}

// GetDCTxtDomainName returns value of DCTxtDomainName field.
func (c *Config) GetDCTxtDomainName() (value string) {
	if c == nil {
		return
	}
	return c.DCTxtDomainName
}

// GetChatSizeMax returns value of ChatSizeMax field.
func (c *Config) GetChatSizeMax() (value int) {
	if c == nil {
		return
	}
	return c.ChatSizeMax
}

// GetMegagroupSizeMax returns value of MegagroupSizeMax field.
func (c *Config) GetMegagroupSizeMax() (value int) {
	if c == nil {
		return
	}
	return c.MegagroupSizeMax
}

// GetForwardedCountMax returns value of ForwardedCountMax field.
func (c *Config) GetForwardedCountMax() (value int) {
	if c == nil {
		return
	}
	return c.ForwardedCountMax
}

// GetOnlineUpdatePeriodMs returns value of OnlineUpdatePeriodMs field.
func (c *Config) GetOnlineUpdatePeriodMs() (value int) {
	if c == nil {
		return
	}
	return c.OnlineUpdatePeriodMs
}

// GetOfflineBlurTimeoutMs returns value of OfflineBlurTimeoutMs field.
func (c *Config) GetOfflineBlurTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.OfflineBlurTimeoutMs
}

// GetOfflineIdleTimeoutMs returns value of OfflineIdleTimeoutMs field.
func (c *Config) GetOfflineIdleTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.OfflineIdleTimeoutMs
}

// GetOnlineCloudTimeoutMs returns value of OnlineCloudTimeoutMs field.
func (c *Config) GetOnlineCloudTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.OnlineCloudTimeoutMs
}

// GetNotifyCloudDelayMs returns value of NotifyCloudDelayMs field.
func (c *Config) GetNotifyCloudDelayMs() (value int) {
	if c == nil {
		return
	}
	return c.NotifyCloudDelayMs
}

// GetNotifyDefaultDelayMs returns value of NotifyDefaultDelayMs field.
func (c *Config) GetNotifyDefaultDelayMs() (value int) {
	if c == nil {
		return
	}
	return c.NotifyDefaultDelayMs
}

// GetPushChatPeriodMs returns value of PushChatPeriodMs field.
func (c *Config) GetPushChatPeriodMs() (value int) {
	if c == nil {
		return
	}
	return c.PushChatPeriodMs
}

// GetPushChatLimit returns value of PushChatLimit field.
func (c *Config) GetPushChatLimit() (value int) {
	if c == nil {
		return
	}
	return c.PushChatLimit
}

// GetEditTimeLimit returns value of EditTimeLimit field.
func (c *Config) GetEditTimeLimit() (value int) {
	if c == nil {
		return
	}
	return c.EditTimeLimit
}

// GetRevokeTimeLimit returns value of RevokeTimeLimit field.
func (c *Config) GetRevokeTimeLimit() (value int) {
	if c == nil {
		return
	}
	return c.RevokeTimeLimit
}

// GetRevokePmTimeLimit returns value of RevokePmTimeLimit field.
func (c *Config) GetRevokePmTimeLimit() (value int) {
	if c == nil {
		return
	}
	return c.RevokePmTimeLimit
}

// GetRatingEDecay returns value of RatingEDecay field.
func (c *Config) GetRatingEDecay() (value int) {
	if c == nil {
		return
	}
	return c.RatingEDecay
}

// GetStickersRecentLimit returns value of StickersRecentLimit field.
func (c *Config) GetStickersRecentLimit() (value int) {
	if c == nil {
		return
	}
	return c.StickersRecentLimit
}

// GetChannelsReadMediaPeriod returns value of ChannelsReadMediaPeriod field.
func (c *Config) GetChannelsReadMediaPeriod() (value int) {
	if c == nil {
		return
	}
	return c.ChannelsReadMediaPeriod
}

// SetTmpSessions sets value of TmpSessions conditional field.
func (c *Config) SetTmpSessions(value int) {
	c.Flags.Set(0)
	c.TmpSessions = value
}

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

// GetCallReceiveTimeoutMs returns value of CallReceiveTimeoutMs field.
func (c *Config) GetCallReceiveTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.CallReceiveTimeoutMs
}

// GetCallRingTimeoutMs returns value of CallRingTimeoutMs field.
func (c *Config) GetCallRingTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.CallRingTimeoutMs
}

// GetCallConnectTimeoutMs returns value of CallConnectTimeoutMs field.
func (c *Config) GetCallConnectTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.CallConnectTimeoutMs
}

// GetCallPacketTimeoutMs returns value of CallPacketTimeoutMs field.
func (c *Config) GetCallPacketTimeoutMs() (value int) {
	if c == nil {
		return
	}
	return c.CallPacketTimeoutMs
}

// GetMeURLPrefix returns value of MeURLPrefix field.
func (c *Config) GetMeURLPrefix() (value string) {
	if c == nil {
		return
	}
	return c.MeURLPrefix
}

// SetAutoupdateURLPrefix sets value of AutoupdateURLPrefix conditional field.
func (c *Config) SetAutoupdateURLPrefix(value string) {
	c.Flags.Set(7)
	c.AutoupdateURLPrefix = value
}

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

// SetGifSearchUsername sets value of GifSearchUsername conditional field.
func (c *Config) SetGifSearchUsername(value string) {
	c.Flags.Set(9)
	c.GifSearchUsername = value
}

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

// SetVenueSearchUsername sets value of VenueSearchUsername conditional field.
func (c *Config) SetVenueSearchUsername(value string) {
	c.Flags.Set(10)
	c.VenueSearchUsername = value
}

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

// SetImgSearchUsername sets value of ImgSearchUsername conditional field.
func (c *Config) SetImgSearchUsername(value string) {
	c.Flags.Set(11)
	c.ImgSearchUsername = value
}

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

// SetStaticMapsProvider sets value of StaticMapsProvider conditional field.
func (c *Config) SetStaticMapsProvider(value string) {
	c.Flags.Set(12)
	c.StaticMapsProvider = value
}

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

// GetCaptionLengthMax returns value of CaptionLengthMax field.
func (c *Config) GetCaptionLengthMax() (value int) {
	if c == nil {
		return
	}
	return c.CaptionLengthMax
}

// GetMessageLengthMax returns value of MessageLengthMax field.
func (c *Config) GetMessageLengthMax() (value int) {
	if c == nil {
		return
	}
	return c.MessageLengthMax
}

// GetWebfileDCID returns value of WebfileDCID field.
func (c *Config) GetWebfileDCID() (value int) {
	if c == nil {
		return
	}
	return c.WebfileDCID
}

// SetSuggestedLangCode sets value of SuggestedLangCode conditional field.
func (c *Config) SetSuggestedLangCode(value string) {
	c.Flags.Set(2)
	c.SuggestedLangCode = value
}

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

// SetLangPackVersion sets value of LangPackVersion conditional field.
func (c *Config) SetLangPackVersion(value int) {
	c.Flags.Set(2)
	c.LangPackVersion = value
}

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

// SetBaseLangPackVersion sets value of BaseLangPackVersion conditional field.
func (c *Config) SetBaseLangPackVersion(value int) {
	c.Flags.Set(2)
	c.BaseLangPackVersion = value
}

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

// SetReactionsDefault sets value of ReactionsDefault conditional field.
func (c *Config) SetReactionsDefault(value ReactionClass) {
	c.Flags.Set(15)
	c.ReactionsDefault = value
}

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

// SetAutologinToken sets value of AutologinToken conditional field.
func (c *Config) SetAutologinToken(value string) {
	c.Flags.Set(16)
	c.AutologinToken = value
}

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