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

// KeyboardInlineButton represents TL type `keyboardInlineButton#11c1a322`.
//
// See https://core.telegram.org/constructor/keyboardInlineButton for reference.
type KeyboardInlineButton struct {
	// Flags field of KeyboardInlineButton.
	Flags bin.Fields
	// Style field of KeyboardInlineButton.
	//
	// Use SetStyle and GetStyle helpers.
	Style KeyboardButtonStyle
	// Text field of KeyboardInlineButton.
	Text string
	// Type field of KeyboardInlineButton.
	Type InlineButtonTypeClass
}

// KeyboardInlineButtonTypeID is TL type id of KeyboardInlineButton.
const KeyboardInlineButtonTypeID = 0x11c1a322

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

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

	return true
}

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

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

	.Text = .()
	.Type = .()
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *KeyboardInlineButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardInlineButton#11c1a322 as nil")
	}
	.PutID(KeyboardInlineButtonTypeID)
	return .EncodeBare()
}

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

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

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

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

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

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

// GetType returns value of Type field.
func ( *KeyboardInlineButton) () ( InlineButtonTypeClass) {
	if  == nil {
		return
	}
	return .Type
}