// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

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

// KeyboardButton represents TL type `keyboardButton#7d170cff`.
// Bot keyboard button
//
// See https://core.telegram.org/constructor/keyboardButton for reference.
type KeyboardButton struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
}

// KeyboardButtonTypeID is TL type id of KeyboardButton.
const KeyboardButtonTypeID = 0x7d170cff

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButton) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButton{}
)

func ( *KeyboardButton) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButton from given interface.
func ( *KeyboardButton) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButton) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButton",
		ID:   KeyboardButtonTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButton) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButton#7d170cff as nil")
	}
	.PutID(KeyboardButtonTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButton#7d170cff as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButton#7d170cff: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButton#7d170cff: field style: %w", )
		}
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButton#7d170cff to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButton#7d170cff: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButton#7d170cff: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButton#7d170cff: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButton) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButton) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButton) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonURL represents TL type `keyboardButtonUrl#d80c25ec`.
// URL button
//
// See https://core.telegram.org/constructor/keyboardButtonUrl for reference.
type KeyboardButtonURL struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button label
	Text string
	// URL
	URL string
}

// KeyboardButtonURLTypeID is TL type id of KeyboardButtonURL.
const KeyboardButtonURLTypeID = 0xd80c25ec

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonURL) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonURL{}
)

func ( *KeyboardButtonURL) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonURL from given interface.
func ( *KeyboardButtonURL) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonURL) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUrl",
		ID:   KeyboardButtonURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonURL) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrl#d80c25ec as nil")
	}
	.PutID(KeyboardButtonURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrl#d80c25ec as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonUrl#d80c25ec: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonUrl#d80c25ec: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrl#d80c25ec to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonURL) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonURL) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonURL) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonURL) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonCallback represents TL type `keyboardButtonCallback#e62bc960`.
// Callback button
//
// See https://core.telegram.org/constructor/keyboardButtonCallback for reference.
type KeyboardButtonCallback struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the user should verify his identity by entering his 2FA SRP parameters¹ to
	// the messages.getBotCallbackAnswer² method. NOTE: telegram and the bot WILL NOT have
	// access to the plaintext password, thanks to SRP³. This button is mainly used by the
	// official @botfather⁴ bot, for verifying the user's identity before transferring
	// ownership of a bot to another user.
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	//  2) https://core.telegram.org/method/messages.getBotCallbackAnswer
	//  3) https://core.telegram.org/api/srp
	//  4) https://t.me/botfather
	RequiresPassword bool
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// Callback data
	Data []byte
}

// KeyboardButtonCallbackTypeID is TL type id of KeyboardButtonCallback.
const KeyboardButtonCallbackTypeID = 0xe62bc960

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonCallback) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonCallback{}
)

func ( *KeyboardButtonCallback) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.RequiresPassword == false) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.Data == nil) {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonCallback from given interface.
func ( *KeyboardButtonCallback) ( interface {
	() ( bool)
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( []byte)
}) {
	.RequiresPassword = .()
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.Data = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonCallback) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonCallback",
		ID:   KeyboardButtonCallbackTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RequiresPassword",
			SchemaName: "requires_password",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Data",
			SchemaName: "data",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonCallback) () {
	if !(.RequiresPassword == false) {
		.Flags.Set(0)
	}
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCallback#e62bc960 as nil")
	}
	.PutID(KeyboardButtonCallbackTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCallback#e62bc960 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonCallback#e62bc960: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonCallback#e62bc960: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutBytes(.Data)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonCallback#e62bc960 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field flags: %w", )
		}
	}
	.RequiresPassword = .Flags.Has(0)
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field data: %w", )
		}
		.Data = 
	}
	return nil
}

// SetRequiresPassword sets value of RequiresPassword conditional field.
func ( *KeyboardButtonCallback) ( bool) {
	if  {
		.Flags.Set(0)
		.RequiresPassword = true
	} else {
		.Flags.Unset(0)
		.RequiresPassword = false
	}
}

// GetRequiresPassword returns value of RequiresPassword conditional field.
func ( *KeyboardButtonCallback) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonCallback) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonCallback) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonCallback) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetData returns value of Data field.
func ( *KeyboardButtonCallback) () ( []byte) {
	if  == nil {
		return
	}
	return .Data
}

// KeyboardButtonRequestPhone represents TL type `keyboardButtonRequestPhone#417efd8f`.
// Button to request a user's phone number
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPhone for reference.
type KeyboardButtonRequestPhone struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
}

// KeyboardButtonRequestPhoneTypeID is TL type id of KeyboardButtonRequestPhone.
const KeyboardButtonRequestPhoneTypeID = 0x417efd8f

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPhone) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonRequestPhone{}
)

func ( *KeyboardButtonRequestPhone) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonRequestPhone from given interface.
func ( *KeyboardButtonRequestPhone) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPhone) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPhone",
		ID:   KeyboardButtonRequestPhoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonRequestPhone) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPhone#417efd8f as nil")
	}
	.PutID(KeyboardButtonRequestPhoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPhone#417efd8f as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPhone#417efd8f: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonRequestPhone#417efd8f: field style: %w", )
		}
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPhone#417efd8f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonRequestPhone) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonRequestPhone) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPhone) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonRequestGeoLocation represents TL type `keyboardButtonRequestGeoLocation#aa40f94d`.
// Button to request a user's geolocation
//
// See https://core.telegram.org/constructor/keyboardButtonRequestGeoLocation for reference.
type KeyboardButtonRequestGeoLocation struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
}

// KeyboardButtonRequestGeoLocationTypeID is TL type id of KeyboardButtonRequestGeoLocation.
const KeyboardButtonRequestGeoLocationTypeID = 0xaa40f94d

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestGeoLocation) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonRequestGeoLocation{}
)

func ( *KeyboardButtonRequestGeoLocation) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonRequestGeoLocation from given interface.
func ( *KeyboardButtonRequestGeoLocation) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestGeoLocation) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestGeoLocation",
		ID:   KeyboardButtonRequestGeoLocationTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonRequestGeoLocation) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#aa40f94d as nil")
	}
	.PutID(KeyboardButtonRequestGeoLocationTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#aa40f94d as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestGeoLocation#aa40f94d: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonRequestGeoLocation#aa40f94d: field style: %w", )
		}
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#aa40f94d to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonRequestGeoLocation) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonRequestGeoLocation) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestGeoLocation) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonSwitchInline represents TL type `keyboardButtonSwitchInline#991399fc`.
// Button to force a user to switch to inline mode: pressing the button will prompt the
// user to select one of their chats, open that chat and insert the bot's username and
// the specified inline query in the input field.
//
// See https://core.telegram.org/constructor/keyboardButtonSwitchInline for reference.
type KeyboardButtonSwitchInline struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, pressing the button will insert the bot's username and the specified inline
	// query in the current chat's input field.
	SamePeer bool
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button label
	Text string
	// The inline query to use
	Query string
	// Filter to use when selecting chats.
	//
	// Use SetPeerTypes and GetPeerTypes helpers.
	PeerTypes []InlineQueryPeerTypeClass
}

// KeyboardButtonSwitchInlineTypeID is TL type id of KeyboardButtonSwitchInline.
const KeyboardButtonSwitchInlineTypeID = 0x991399fc

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonSwitchInline) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonSwitchInline{}
)

func ( *KeyboardButtonSwitchInline) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.SamePeer == false) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.Query == "") {
		return false
	}
	if !(.PeerTypes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonSwitchInline from given interface.
func ( *KeyboardButtonSwitchInline) ( interface {
	() ( bool)
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string)
	() ( []InlineQueryPeerTypeClass,  bool)
}) {
	.SamePeer = .()
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.Query = .()
	if ,  := .();  {
		.PeerTypes = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonSwitchInline) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonSwitchInline",
		ID:   KeyboardButtonSwitchInlineTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "SamePeer",
			SchemaName: "same_peer",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
		{
			Name:       "PeerTypes",
			SchemaName: "peer_types",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonSwitchInline) () {
	if !(.SamePeer == false) {
		.Flags.Set(0)
	}
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
	if !(.PeerTypes == nil) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSwitchInline#991399fc as nil")
	}
	.PutID(KeyboardButtonSwitchInlineTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSwitchInline#991399fc as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutString(.Query)
	if .Flags.Has(1) {
		.PutVectorHeader(len(.PeerTypes))
		for ,  := range .PeerTypes {
			if  == nil {
				return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field peer_types element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field peer_types element with index %d: %w", , )
			}
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSwitchInline#991399fc to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field flags: %w", )
		}
	}
	.SamePeer = .Flags.Has(0)
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field query: %w", )
		}
		.Query = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field peer_types: %w", )
		}

		if  > 0 {
			.PeerTypes = make([]InlineQueryPeerTypeClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInlineQueryPeerType()
			if  != nil {
				return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field peer_types: %w", )
			}
			.PeerTypes = append(.PeerTypes, )
		}
	}
	return nil
}

// SetSamePeer sets value of SamePeer conditional field.
func ( *KeyboardButtonSwitchInline) ( bool) {
	if  {
		.Flags.Set(0)
		.SamePeer = true
	} else {
		.Flags.Unset(0)
		.SamePeer = false
	}
}

// GetSamePeer returns value of SamePeer conditional field.
func ( *KeyboardButtonSwitchInline) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonSwitchInline) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonSwitchInline) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonSwitchInline) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetQuery returns value of Query field.
func ( *KeyboardButtonSwitchInline) () ( string) {
	if  == nil {
		return
	}
	return .Query
}

// SetPeerTypes sets value of PeerTypes conditional field.
func ( *KeyboardButtonSwitchInline) ( []InlineQueryPeerTypeClass) {
	.Flags.Set(1)
	.PeerTypes = 
}

// GetPeerTypes returns value of PeerTypes conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonSwitchInline) () ( []InlineQueryPeerTypeClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .PeerTypes, true
}

// MapPeerTypes returns field PeerTypes wrapped in InlineQueryPeerTypeClassArray helper.
func ( *KeyboardButtonSwitchInline) () ( InlineQueryPeerTypeClassArray,  bool) {
	if !.Flags.Has(1) {
		return , false
	}
	return InlineQueryPeerTypeClassArray(.PeerTypes), true
}

// KeyboardButtonGame represents TL type `keyboardButtonGame#89c590f9`.
// Button to start a game
//
// See https://core.telegram.org/constructor/keyboardButtonGame for reference.
type KeyboardButtonGame struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
}

// KeyboardButtonGameTypeID is TL type id of KeyboardButtonGame.
const KeyboardButtonGameTypeID = 0x89c590f9

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonGame) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonGame{}
)

func ( *KeyboardButtonGame) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonGame from given interface.
func ( *KeyboardButtonGame) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonGame) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonGame",
		ID:   KeyboardButtonGameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonGame) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonGame#89c590f9 as nil")
	}
	.PutID(KeyboardButtonGameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonGame#89c590f9 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonGame#89c590f9: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonGame#89c590f9: field style: %w", )
		}
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonGame#89c590f9 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonGame) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonGame) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonGame) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonBuy represents TL type `keyboardButtonBuy#3fa53905`.
// Button to buy a product
//
// See https://core.telegram.org/constructor/keyboardButtonBuy for reference.
type KeyboardButtonBuy struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
}

// KeyboardButtonBuyTypeID is TL type id of KeyboardButtonBuy.
const KeyboardButtonBuyTypeID = 0x3fa53905

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonBuy) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonBuy{}
)

func ( *KeyboardButtonBuy) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonBuy from given interface.
func ( *KeyboardButtonBuy) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonBuy) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonBuy",
		ID:   KeyboardButtonBuyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonBuy) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonBuy#3fa53905 as nil")
	}
	.PutID(KeyboardButtonBuyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonBuy#3fa53905 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonBuy#3fa53905: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonBuy#3fa53905: field style: %w", )
		}
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonBuy#3fa53905 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonBuy) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonBuy) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonBuy) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonURLAuth represents TL type `keyboardButtonUrlAuth#f51006f9`.
// Button to request a user to authorize via URL using Seamless Telegram Login¹. When
// the user clicks on such a button, messages.requestUrlAuth² should be called,
// providing the button_id and the ID of the container message. The returned
// urlAuthResultRequest³ object will contain more details about the authorization
// request (request_write_access if the bot would like to send messages to the user along
// with the username of the bot which will be used for user authorization). Finally, the
// user can choose to call messages.acceptUrlAuth⁴ to get a urlAuthResultAccepted⁵
// with the URL to open instead of the url of this constructor, or a
// urlAuthResultDefault⁶, in which case the url of this constructor must be opened,
// instead. If the user refuses the authorization request but still wants to open the
// link, the url of this constructor must be used.
//
// Links:
//  1. https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots
//  2. https://core.telegram.org/method/messages.requestUrlAuth
//  3. https://core.telegram.org/constructor/urlAuthResultRequest
//  4. https://core.telegram.org/method/messages.acceptUrlAuth
//  5. https://core.telegram.org/constructor/urlAuthResultAccepted
//  6. https://core.telegram.org/constructor/urlAuthResultDefault
//
// See https://core.telegram.org/constructor/keyboardButtonUrlAuth for reference.
type KeyboardButtonURLAuth struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button label
	Text string
	// New text of the button in forwarded messages.
	//
	// Use SetFwdText and GetFwdText helpers.
	FwdText string
	// An HTTP URL to be opened with user authorization data added to the query string when
	// the button is pressed. If the user refuses to provide authorization data, the original
	// URL without information about the user will be opened. The data added is the same as
	// described in Receiving authorization data¹.NOTE: Services must always check the hash
	// of the received data to verify the authentication and the integrity of the data as
	// described in Checking authorization².
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#receiving-authorization-data
	//  2) https://core.telegram.org/widgets/login#checking-authorization
	URL string
	// ID of the button to pass to messages.requestUrlAuth¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.requestUrlAuth
	ButtonID int
}

// KeyboardButtonURLAuthTypeID is TL type id of KeyboardButtonURLAuth.
const KeyboardButtonURLAuthTypeID = 0xf51006f9

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonURLAuth) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonURLAuth{}
)

func ( *KeyboardButtonURLAuth) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.FwdText == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.ButtonID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonURLAuth from given interface.
func ( *KeyboardButtonURLAuth) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string,  bool)
	() ( string)
	() ( int)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	if ,  := .();  {
		.FwdText = 
	}

	.URL = .()
	.ButtonID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonURLAuth) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUrlAuth",
		ID:   KeyboardButtonURLAuthTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "FwdText",
			SchemaName: "fwd_text",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonURLAuth) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
	if !(.FwdText == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrlAuth#f51006f9 as nil")
	}
	.PutID(KeyboardButtonURLAuthTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrlAuth#f51006f9 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonUrlAuth#f51006f9: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonUrlAuth#f51006f9: field style: %w", )
		}
	}
	.PutString(.Text)
	if .Flags.Has(0) {
		.PutString(.FwdText)
	}
	.PutString(.URL)
	.PutInt(.ButtonID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrlAuth#f51006f9 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field text: %w", )
		}
		.Text = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field fwd_text: %w", )
		}
		.FwdText = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field button_id: %w", )
		}
		.ButtonID = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonURLAuth) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonURLAuth) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// SetFwdText sets value of FwdText conditional field.
func ( *KeyboardButtonURLAuth) ( string) {
	.Flags.Set(0)
	.FwdText = 
}

// GetFwdText returns value of FwdText conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonURLAuth) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .FwdText, true
}

// GetURL returns value of URL field.
func ( *KeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetButtonID returns value of ButtonID field.
func ( *KeyboardButtonURLAuth) () ( int) {
	if  == nil {
		return
	}
	return .ButtonID
}

// InputKeyboardButtonURLAuth represents TL type `inputKeyboardButtonUrlAuth#68013e72`.
// Button to request a user to authorize¹ via URL using Seamless Telegram Login².
//
// Links:
//  1. https://core.telegram.org/method/messages.acceptUrlAuth
//  2. https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots
//
// See https://core.telegram.org/constructor/inputKeyboardButtonUrlAuth for reference.
type InputKeyboardButtonURLAuth struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// New text of the button in forwarded messages.
	//
	// Use SetFwdText and GetFwdText helpers.
	FwdText string
	// An HTTP URL to be opened with user authorization data added to the query string when
	// the button is pressed. If the user refuses to provide authorization data, the original
	// URL without information about the user will be opened. The data added is the same as
	// described in Receiving authorization data¹.NOTE: You must always check the hash of
	// the received data to verify the authentication and the integrity of the data as
	// described in Checking authorization².
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#receiving-authorization-data
	//  2) https://core.telegram.org/widgets/login#checking-authorization
	URL string
	// Username of a bot, which will be used for user authorization. See Setting up a bot¹
	// for more details. If not specified, the current bot's username will be assumed. The
	// url's domain must be the same as the domain linked with the bot. See Linking your
	// domain to the bot² for more details.
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#setting-up-a-bot
	//  2) https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot
	Bot InputUserClass
}

// InputKeyboardButtonURLAuthTypeID is TL type id of InputKeyboardButtonURLAuth.
const InputKeyboardButtonURLAuthTypeID = 0x68013e72

// construct implements constructor of KeyboardButtonClass.
func ( InputKeyboardButtonURLAuth) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &InputKeyboardButtonURLAuth{}
)

func ( *InputKeyboardButtonURLAuth) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.RequestWriteAccess == false) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.FwdText == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.Bot == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputKeyboardButtonURLAuth from given interface.
func ( *InputKeyboardButtonURLAuth) ( interface {
	() ( bool)
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string,  bool)
	() ( string)
	() ( InputUserClass)
}) {
	.RequestWriteAccess = .()
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	if ,  := .();  {
		.FwdText = 
	}

	.URL = .()
	.Bot = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputKeyboardButtonURLAuth) () tdp.Type {
	 := tdp.Type{
		Name: "inputKeyboardButtonUrlAuth",
		ID:   InputKeyboardButtonURLAuthTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RequestWriteAccess",
			SchemaName: "request_write_access",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "FwdText",
			SchemaName: "fwd_text",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputKeyboardButtonURLAuth) () {
	if !(.RequestWriteAccess == false) {
		.Flags.Set(0)
	}
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
	if !(.FwdText == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#68013e72 as nil")
	}
	.PutID(InputKeyboardButtonURLAuthTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#68013e72 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field style: %w", )
		}
	}
	.PutString(.Text)
	if .Flags.Has(1) {
		.PutString(.FwdText)
	}
	.PutString(.URL)
	if .Bot == nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field bot: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#68013e72 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field flags: %w", )
		}
	}
	.RequestWriteAccess = .Flags.Has(0)
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field text: %w", )
		}
		.Text = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field fwd_text: %w", )
		}
		.FwdText = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field url: %w", )
		}
		.URL = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field bot: %w", )
		}
		.Bot = 
	}
	return nil
}

// SetRequestWriteAccess sets value of RequestWriteAccess conditional field.
func ( *InputKeyboardButtonURLAuth) ( bool) {
	if  {
		.Flags.Set(0)
		.RequestWriteAccess = true
	} else {
		.Flags.Unset(0)
		.RequestWriteAccess = false
	}
}

// GetRequestWriteAccess returns value of RequestWriteAccess conditional field.
func ( *InputKeyboardButtonURLAuth) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetStyle sets value of Style conditional field.
func ( *InputKeyboardButtonURLAuth) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *InputKeyboardButtonURLAuth) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *InputKeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// SetFwdText sets value of FwdText conditional field.
func ( *InputKeyboardButtonURLAuth) ( string) {
	.Flags.Set(1)
	.FwdText = 
}

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

// GetURL returns value of URL field.
func ( *InputKeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetBot returns value of Bot field.
func ( *InputKeyboardButtonURLAuth) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .Bot
}

// KeyboardButtonRequestPoll represents TL type `keyboardButtonRequestPoll#7a11d782`.
// A button that allows the user to create and send a poll when pressed; available only
// in private
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPoll for reference.
type KeyboardButtonRequestPoll struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// If set, only quiz polls can be sent
	//
	// Use SetQuiz and GetQuiz helpers.
	Quiz bool
	// Button text
	Text string
}

// KeyboardButtonRequestPollTypeID is TL type id of KeyboardButtonRequestPoll.
const KeyboardButtonRequestPollTypeID = 0x7a11d782

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPoll) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonRequestPoll{}
)

func ( *KeyboardButtonRequestPoll) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Quiz == false) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonRequestPoll from given interface.
func ( *KeyboardButtonRequestPoll) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( bool,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

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

	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPoll) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPoll",
		ID:   KeyboardButtonRequestPollTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Quiz",
			SchemaName: "quiz",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonRequestPoll) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
	if !(.Quiz == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPoll#7a11d782 as nil")
	}
	.PutID(KeyboardButtonRequestPollTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPoll#7a11d782 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPoll#7a11d782: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonRequestPoll#7a11d782: field style: %w", )
		}
	}
	if .Flags.Has(0) {
		.PutBool(.Quiz)
	}
	.PutString(.Text)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPoll#7a11d782 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field style: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field quiz: %w", )
		}
		.Quiz = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonRequestPoll) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonRequestPoll) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// SetQuiz sets value of Quiz conditional field.
func ( *KeyboardButtonRequestPoll) ( bool) {
	.Flags.Set(0)
	.Quiz = 
}

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

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPoll) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// InputKeyboardButtonUserProfile represents TL type `inputKeyboardButtonUserProfile#7d5e07c7`.
// Button that links directly to a user profile
//
// See https://core.telegram.org/constructor/inputKeyboardButtonUserProfile for reference.
type InputKeyboardButtonUserProfile struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// User ID
	UserID InputUserClass
}

// InputKeyboardButtonUserProfileTypeID is TL type id of InputKeyboardButtonUserProfile.
const InputKeyboardButtonUserProfileTypeID = 0x7d5e07c7

// construct implements constructor of KeyboardButtonClass.
func ( InputKeyboardButtonUserProfile) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &InputKeyboardButtonUserProfile{}
)

func ( *InputKeyboardButtonUserProfile) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.UserID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputKeyboardButtonUserProfile from given interface.
func ( *InputKeyboardButtonUserProfile) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( InputUserClass)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputKeyboardButtonUserProfile) () tdp.Type {
	 := tdp.Type{
		Name: "inputKeyboardButtonUserProfile",
		ID:   InputKeyboardButtonUserProfileTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputKeyboardButtonUserProfile) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#7d5e07c7 as nil")
	}
	.PutID(InputKeyboardButtonUserProfileTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#7d5e07c7 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field style: %w", )
		}
	}
	.PutString(.Text)
	if .UserID == nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field user_id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#7d5e07c7 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field text: %w", )
		}
		.Text = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *InputKeyboardButtonUserProfile) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *InputKeyboardButtonUserProfile) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *InputKeyboardButtonUserProfile) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetUserID returns value of UserID field.
func ( *InputKeyboardButtonUserProfile) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// KeyboardButtonUserProfile represents TL type `keyboardButtonUserProfile#c0fd5d09`.
// Button that links directly to a user profile
//
// See https://core.telegram.org/constructor/keyboardButtonUserProfile for reference.
type KeyboardButtonUserProfile struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// User ID
	UserID int64
}

// KeyboardButtonUserProfileTypeID is TL type id of KeyboardButtonUserProfile.
const KeyboardButtonUserProfileTypeID = 0xc0fd5d09

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonUserProfile) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonUserProfile{}
)

func ( *KeyboardButtonUserProfile) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.UserID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonUserProfile from given interface.
func ( *KeyboardButtonUserProfile) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( int64)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonUserProfile) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUserProfile",
		ID:   KeyboardButtonUserProfileTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonUserProfile) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUserProfile#c0fd5d09 as nil")
	}
	.PutID(KeyboardButtonUserProfileTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUserProfile#c0fd5d09 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonUserProfile#c0fd5d09: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonUserProfile#c0fd5d09: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutLong(.UserID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUserProfile#c0fd5d09 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonUserProfile) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonUserProfile) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonUserProfile) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetUserID returns value of UserID field.
func ( *KeyboardButtonUserProfile) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

// KeyboardButtonWebView represents TL type `keyboardButtonWebView#e846b1a0`.
// Button to open a bot mini app¹ using messages.requestWebView², sending over user
// information after user confirmation.
// Can only be sent or received as part of an inline keyboard, use
// keyboardButtonSimpleWebView¹ for reply keyboards.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//  2. https://core.telegram.org/method/messages.requestWebView
//  3. https://core.telegram.org/constructor/keyboardButtonSimpleWebView
//
// See https://core.telegram.org/constructor/keyboardButtonWebView for reference.
type KeyboardButtonWebView struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// Web app url¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps
	URL string
}

// KeyboardButtonWebViewTypeID is TL type id of KeyboardButtonWebView.
const KeyboardButtonWebViewTypeID = 0xe846b1a0

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonWebView) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonWebView{}
)

func ( *KeyboardButtonWebView) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonWebView from given interface.
func ( *KeyboardButtonWebView) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonWebView) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonWebView",
		ID:   KeyboardButtonWebViewTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonWebView) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonWebView#e846b1a0 as nil")
	}
	.PutID(KeyboardButtonWebViewTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonWebView#e846b1a0 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonWebView#e846b1a0: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonWebView#e846b1a0: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonWebView#e846b1a0 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonWebView) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonWebView) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonWebView) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonWebView) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonSimpleWebView represents TL type `keyboardButtonSimpleWebView#e15c4370`.
// Button to open a bot mini app¹ using messages.requestSimpleWebView², without sending
// user information to the web app.
// Can only be sent or received as part of a reply keyboard, use keyboardButtonWebView¹
// for inline keyboards.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//  2. https://core.telegram.org/method/messages.requestSimpleWebView
//  3. https://core.telegram.org/constructor/keyboardButtonWebView
//
// See https://core.telegram.org/constructor/keyboardButtonSimpleWebView for reference.
type KeyboardButtonSimpleWebView struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// Web app URL¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps
	URL string
}

// KeyboardButtonSimpleWebViewTypeID is TL type id of KeyboardButtonSimpleWebView.
const KeyboardButtonSimpleWebViewTypeID = 0xe15c4370

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonSimpleWebView) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonSimpleWebView{}
)

func ( *KeyboardButtonSimpleWebView) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonSimpleWebView from given interface.
func ( *KeyboardButtonSimpleWebView) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonSimpleWebView) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonSimpleWebView",
		ID:   KeyboardButtonSimpleWebViewTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonSimpleWebView) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSimpleWebView#e15c4370 as nil")
	}
	.PutID(KeyboardButtonSimpleWebViewTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSimpleWebView#e15c4370 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonSimpleWebView#e15c4370: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonSimpleWebView#e15c4370: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSimpleWebView#e15c4370 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonSimpleWebView) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonSimpleWebView) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonSimpleWebView) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonSimpleWebView) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#5b0f15f5`.
// Prompts the user to select and share one or more peers with the bot using messages
// sendBotRequestedPeer¹
//
// Links:
//  1. https://core.telegram.org/method/messages.sendBotRequestedPeer
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPeer for reference.
type KeyboardButtonRequestPeer struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// Button ID, to be passed to messages.sendBotRequestedPeer¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.sendBotRequestedPeer
	ButtonID int
	// Filtering criteria to use for the peer selection list shown to the user. The list
	// should display all existing peers of the specified type, and should also offer an
	// option for the user to create and immediately use one or more (up to max_quantity)
	// peers of the specified type, if needed.
	PeerType RequestPeerTypeClass
	// Maximum number of peers that can be chosen.
	MaxQuantity int
}

// KeyboardButtonRequestPeerTypeID is TL type id of KeyboardButtonRequestPeer.
const KeyboardButtonRequestPeerTypeID = 0x5b0f15f5

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPeer) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonRequestPeer{}
)

func ( *KeyboardButtonRequestPeer) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.ButtonID == 0) {
		return false
	}
	if !(.PeerType == nil) {
		return false
	}
	if !(.MaxQuantity == 0) {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonRequestPeer from given interface.
func ( *KeyboardButtonRequestPeer) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( int)
	() ( RequestPeerTypeClass)
	() ( int)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.ButtonID = .()
	.PeerType = .()
	.MaxQuantity = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPeer) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPeer",
		ID:   KeyboardButtonRequestPeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
		{
			Name:       "PeerType",
			SchemaName: "peer_type",
		},
		{
			Name:       "MaxQuantity",
			SchemaName: "max_quantity",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonRequestPeer) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPeer#5b0f15f5 as nil")
	}
	.PutID(KeyboardButtonRequestPeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPeer#5b0f15f5 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutInt(.ButtonID)
	if .PeerType == nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field peer_type is nil")
	}
	if  := .PeerType.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field peer_type: %w", )
	}
	.PutInt(.MaxQuantity)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPeer#5b0f15f5 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field button_id: %w", )
		}
		.ButtonID = 
	}
	{
		,  := DecodeRequestPeerType()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field peer_type: %w", )
		}
		.PeerType = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field max_quantity: %w", )
		}
		.MaxQuantity = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonRequestPeer) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonRequestPeer) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPeer) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetButtonID returns value of ButtonID field.
func ( *KeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .ButtonID
}

// GetPeerType returns value of PeerType field.
func ( *KeyboardButtonRequestPeer) () ( RequestPeerTypeClass) {
	if  == nil {
		return
	}
	return .PeerType
}

// GetMaxQuantity returns value of MaxQuantity field.
func ( *KeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .MaxQuantity
}

// InputKeyboardButtonRequestPeer represents TL type `inputKeyboardButtonRequestPeer#2b78156`.
// Prompts the user to select and share one or more peers with the bot using messages
// sendBotRequestedPeer¹.
//
// Links:
//  1. https://core.telegram.org/method/messages.sendBotRequestedPeer
//
// See https://core.telegram.org/constructor/inputKeyboardButtonRequestPeer for reference.
type InputKeyboardButtonRequestPeer struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag to request the peer's name.
	NameRequested bool
	// Set this flag to request the peer's @username (if any).
	UsernameRequested bool
	// Set this flag to request the peer's photo (if any).
	PhotoRequested bool
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Button text
	Text string
	// Button ID, to be passed to messages.sendBotRequestedPeer¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.sendBotRequestedPeer
	ButtonID int
	// Filtering criteria to use for the peer selection list shown to the user. The list
	// should display all existing peers of the specified type, and should also offer an
	// option for the user to create and immediately use one or more (up to max_quantity)
	// peers of the specified type, if needed.
	PeerType RequestPeerTypeClass
	// Maximum number of peers that can be chosen.
	MaxQuantity int
}

// InputKeyboardButtonRequestPeerTypeID is TL type id of InputKeyboardButtonRequestPeer.
const InputKeyboardButtonRequestPeerTypeID = 0x2b78156

// construct implements constructor of KeyboardButtonClass.
func ( InputKeyboardButtonRequestPeer) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &InputKeyboardButtonRequestPeer{}
)

func ( *InputKeyboardButtonRequestPeer) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.NameRequested == false) {
		return false
	}
	if !(.UsernameRequested == false) {
		return false
	}
	if !(.PhotoRequested == false) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.ButtonID == 0) {
		return false
	}
	if !(.PeerType == nil) {
		return false
	}
	if !(.MaxQuantity == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputKeyboardButtonRequestPeer from given interface.
func ( *InputKeyboardButtonRequestPeer) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( int)
	() ( RequestPeerTypeClass)
	() ( int)
}) {
	.NameRequested = .()
	.UsernameRequested = .()
	.PhotoRequested = .()
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.ButtonID = .()
	.PeerType = .()
	.MaxQuantity = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputKeyboardButtonRequestPeer) () tdp.Type {
	 := tdp.Type{
		Name: "inputKeyboardButtonRequestPeer",
		ID:   InputKeyboardButtonRequestPeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "NameRequested",
			SchemaName: "name_requested",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "UsernameRequested",
			SchemaName: "username_requested",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "PhotoRequested",
			SchemaName: "photo_requested",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
		{
			Name:       "PeerType",
			SchemaName: "peer_type",
		},
		{
			Name:       "MaxQuantity",
			SchemaName: "max_quantity",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputKeyboardButtonRequestPeer) () {
	if !(.NameRequested == false) {
		.Flags.Set(0)
	}
	if !(.UsernameRequested == false) {
		.Flags.Set(1)
	}
	if !(.PhotoRequested == false) {
		.Flags.Set(2)
	}
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *InputKeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#2b78156 as nil")
	}
	.PutID(InputKeyboardButtonRequestPeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputKeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#2b78156 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutInt(.ButtonID)
	if .PeerType == nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field peer_type is nil")
	}
	if  := .PeerType.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field peer_type: %w", )
	}
	.PutInt(.MaxQuantity)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputKeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonRequestPeer#2b78156 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field flags: %w", )
		}
	}
	.NameRequested = .Flags.Has(0)
	.UsernameRequested = .Flags.Has(1)
	.PhotoRequested = .Flags.Has(2)
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field button_id: %w", )
		}
		.ButtonID = 
	}
	{
		,  := DecodeRequestPeerType()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field peer_type: %w", )
		}
		.PeerType = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field max_quantity: %w", )
		}
		.MaxQuantity = 
	}
	return nil
}

// SetNameRequested sets value of NameRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) ( bool) {
	if  {
		.Flags.Set(0)
		.NameRequested = true
	} else {
		.Flags.Unset(0)
		.NameRequested = false
	}
}

// GetNameRequested returns value of NameRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetUsernameRequested sets value of UsernameRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) ( bool) {
	if  {
		.Flags.Set(1)
		.UsernameRequested = true
	} else {
		.Flags.Unset(1)
		.UsernameRequested = false
	}
}

// GetUsernameRequested returns value of UsernameRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetPhotoRequested sets value of PhotoRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) ( bool) {
	if  {
		.Flags.Set(2)
		.PhotoRequested = true
	} else {
		.Flags.Unset(2)
		.PhotoRequested = false
	}
}

// GetPhotoRequested returns value of PhotoRequested conditional field.
func ( *InputKeyboardButtonRequestPeer) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetStyle sets value of Style conditional field.
func ( *InputKeyboardButtonRequestPeer) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *InputKeyboardButtonRequestPeer) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *InputKeyboardButtonRequestPeer) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetButtonID returns value of ButtonID field.
func ( *InputKeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .ButtonID
}

// GetPeerType returns value of PeerType field.
func ( *InputKeyboardButtonRequestPeer) () ( RequestPeerTypeClass) {
	if  == nil {
		return
	}
	return .PeerType
}

// GetMaxQuantity returns value of MaxQuantity field.
func ( *InputKeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .MaxQuantity
}

// KeyboardButtonCopy represents TL type `keyboardButtonCopy#bcc4af10`.
// Clipboard button: when clicked, the attached text must be copied to the clipboard.
//
// See https://core.telegram.org/constructor/keyboardButtonCopy for reference.
type KeyboardButtonCopy struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Title of the button
	Text string
	// The text that will be copied to the clipboard
	CopyText string
}

// KeyboardButtonCopyTypeID is TL type id of KeyboardButtonCopy.
const KeyboardButtonCopyTypeID = 0xbcc4af10

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonCopy) () KeyboardButtonClass { return & }

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

	_ KeyboardButtonClass = &KeyboardButtonCopy{}
)

func ( *KeyboardButtonCopy) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Style.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.CopyText == "") {
		return false
	}

	return true
}

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

// FillFrom fills KeyboardButtonCopy from given interface.
func ( *KeyboardButtonCopy) ( interface {
	() ( KeyboardButtonStyle,  bool)
	() ( string)
	() ( string)
}) {
	if ,  := .();  {
		.Style = 
	}

	.Text = .()
	.CopyText = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *KeyboardButtonCopy) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonCopy",
		ID:   KeyboardButtonCopyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Style",
			SchemaName: "style",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "CopyText",
			SchemaName: "copy_text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonCopy) () {
	if !(.Style.Zero()) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCopy#bcc4af10 as nil")
	}
	.PutID(KeyboardButtonCopyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCopy#bcc4af10 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonCopy#bcc4af10: field flags: %w", )
	}
	if .Flags.Has(10) {
		if  := .Style.Encode();  != nil {
			return fmt.Errorf("unable to encode keyboardButtonCopy#bcc4af10: field style: %w", )
		}
	}
	.PutString(.Text)
	.PutString(.CopyText)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonCopy#bcc4af10 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field flags: %w", )
		}
	}
	if .Flags.Has(10) {
		if  := .Style.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field style: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field copy_text: %w", )
		}
		.CopyText = 
	}
	return nil
}

// SetStyle sets value of Style conditional field.
func ( *KeyboardButtonCopy) ( KeyboardButtonStyle) {
	.Flags.Set(10)
	.Style = 
}

// GetStyle returns value of Style conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonCopy) () ( KeyboardButtonStyle,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .Style, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonCopy) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetCopyText returns value of CopyText field.
func ( *KeyboardButtonCopy) () ( string) {
	if  == nil {
		return
	}
	return .CopyText
}

// KeyboardButtonClassName is schema name of KeyboardButtonClass.
const KeyboardButtonClassName = "KeyboardButton"

// KeyboardButtonClass represents KeyboardButton generic type.
//
// See https://core.telegram.org/type/KeyboardButton for reference.
//
// Constructors:
//   - [KeyboardButton]
//   - [KeyboardButtonURL]
//   - [KeyboardButtonCallback]
//   - [KeyboardButtonRequestPhone]
//   - [KeyboardButtonRequestGeoLocation]
//   - [KeyboardButtonSwitchInline]
//   - [KeyboardButtonGame]
//   - [KeyboardButtonBuy]
//   - [KeyboardButtonURLAuth]
//   - [InputKeyboardButtonURLAuth]
//   - [KeyboardButtonRequestPoll]
//   - [InputKeyboardButtonUserProfile]
//   - [KeyboardButtonUserProfile]
//   - [KeyboardButtonWebView]
//   - [KeyboardButtonSimpleWebView]
//   - [KeyboardButtonRequestPeer]
//   - [InputKeyboardButtonRequestPeer]
//   - [KeyboardButtonCopy]
//
// Example:
//
//	g, err := tg.DecodeKeyboardButton(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.KeyboardButton: // keyboardButton#7d170cff
//	case *tg.KeyboardButtonURL: // keyboardButtonUrl#d80c25ec
//	case *tg.KeyboardButtonCallback: // keyboardButtonCallback#e62bc960
//	case *tg.KeyboardButtonRequestPhone: // keyboardButtonRequestPhone#417efd8f
//	case *tg.KeyboardButtonRequestGeoLocation: // keyboardButtonRequestGeoLocation#aa40f94d
//	case *tg.KeyboardButtonSwitchInline: // keyboardButtonSwitchInline#991399fc
//	case *tg.KeyboardButtonGame: // keyboardButtonGame#89c590f9
//	case *tg.KeyboardButtonBuy: // keyboardButtonBuy#3fa53905
//	case *tg.KeyboardButtonURLAuth: // keyboardButtonUrlAuth#f51006f9
//	case *tg.InputKeyboardButtonURLAuth: // inputKeyboardButtonUrlAuth#68013e72
//	case *tg.KeyboardButtonRequestPoll: // keyboardButtonRequestPoll#7a11d782
//	case *tg.InputKeyboardButtonUserProfile: // inputKeyboardButtonUserProfile#7d5e07c7
//	case *tg.KeyboardButtonUserProfile: // keyboardButtonUserProfile#c0fd5d09
//	case *tg.KeyboardButtonWebView: // keyboardButtonWebView#e846b1a0
//	case *tg.KeyboardButtonSimpleWebView: // keyboardButtonSimpleWebView#e15c4370
//	case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#5b0f15f5
//	case *tg.InputKeyboardButtonRequestPeer: // inputKeyboardButtonRequestPeer#2b78156
//	case *tg.KeyboardButtonCopy: // keyboardButtonCopy#bcc4af10
//	default: panic(v)
//	}
type KeyboardButtonClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() KeyboardButtonClass

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

	// Button style, see here »¹ for more info on button styles.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/buttons#button-styles
	GetStyle() (value KeyboardButtonStyle, ok bool)

	// Button text
	GetText() (value string)
}

// DecodeKeyboardButton implements binary de-serialization for KeyboardButtonClass.
func ( *bin.Buffer) (KeyboardButtonClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case KeyboardButtonTypeID:
		// Decoding keyboardButton#7d170cff.
		 := KeyboardButton{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonURLTypeID:
		// Decoding keyboardButtonUrl#d80c25ec.
		 := KeyboardButtonURL{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonCallbackTypeID:
		// Decoding keyboardButtonCallback#e62bc960.
		 := KeyboardButtonCallback{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPhoneTypeID:
		// Decoding keyboardButtonRequestPhone#417efd8f.
		 := KeyboardButtonRequestPhone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestGeoLocationTypeID:
		// Decoding keyboardButtonRequestGeoLocation#aa40f94d.
		 := KeyboardButtonRequestGeoLocation{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonSwitchInlineTypeID:
		// Decoding keyboardButtonSwitchInline#991399fc.
		 := KeyboardButtonSwitchInline{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonGameTypeID:
		// Decoding keyboardButtonGame#89c590f9.
		 := KeyboardButtonGame{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonBuyTypeID:
		// Decoding keyboardButtonBuy#3fa53905.
		 := KeyboardButtonBuy{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonURLAuthTypeID:
		// Decoding keyboardButtonUrlAuth#f51006f9.
		 := KeyboardButtonURLAuth{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case InputKeyboardButtonURLAuthTypeID:
		// Decoding inputKeyboardButtonUrlAuth#68013e72.
		 := InputKeyboardButtonURLAuth{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPollTypeID:
		// Decoding keyboardButtonRequestPoll#7a11d782.
		 := KeyboardButtonRequestPoll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case InputKeyboardButtonUserProfileTypeID:
		// Decoding inputKeyboardButtonUserProfile#7d5e07c7.
		 := InputKeyboardButtonUserProfile{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonUserProfileTypeID:
		// Decoding keyboardButtonUserProfile#c0fd5d09.
		 := KeyboardButtonUserProfile{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonWebViewTypeID:
		// Decoding keyboardButtonWebView#e846b1a0.
		 := KeyboardButtonWebView{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonSimpleWebViewTypeID:
		// Decoding keyboardButtonSimpleWebView#e15c4370.
		 := KeyboardButtonSimpleWebView{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPeerTypeID:
		// Decoding keyboardButtonRequestPeer#5b0f15f5.
		 := KeyboardButtonRequestPeer{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case InputKeyboardButtonRequestPeerTypeID:
		// Decoding inputKeyboardButtonRequestPeer#2b78156.
		 := InputKeyboardButtonRequestPeer{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonCopyTypeID:
		// Decoding keyboardButtonCopy#bcc4af10.
		 := KeyboardButtonCopy{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", bin.NewUnexpectedID())
	}
}

// KeyboardButton boxes the KeyboardButtonClass providing a helper.
type KeyboardButtonBox struct {
	KeyboardButton KeyboardButtonClass
}

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

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