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

// InlineBotSwitchPM represents TL type `inlineBotSwitchPM#3c20629f`.
// The bot requested the user to message them in private
//
// See https://core.telegram.org/constructor/inlineBotSwitchPM for reference.
type InlineBotSwitchPM struct {
	// Text for the button that switches the user to a private chat with the bot and sends
	// the bot a start message with the parameter start_parameter (can be empty)
	Text string
	// The parameter for the /start parameter
	StartParam string
}

// InlineBotSwitchPMTypeID is TL type id of InlineBotSwitchPM.
const InlineBotSwitchPMTypeID = 0x3c20629f

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

func ( *InlineBotSwitchPM) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.StartParam == "") {
		return false
	}

	return true
}

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

// FillFrom fills InlineBotSwitchPM from given interface.
func ( *InlineBotSwitchPM) ( interface {
	() ( string)
	() ( string)
}) {
	.Text = .()
	.StartParam = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InlineBotSwitchPM) () tdp.Type {
	 := tdp.Type{
		Name: "inlineBotSwitchPM",
		ID:   InlineBotSwitchPMTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "StartParam",
			SchemaName: "start_param",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InlineBotSwitchPM) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inlineBotSwitchPM#3c20629f as nil")
	}
	.PutID(InlineBotSwitchPMTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InlineBotSwitchPM) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inlineBotSwitchPM#3c20629f as nil")
	}
	.PutString(.Text)
	.PutString(.StartParam)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InlineBotSwitchPM) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inlineBotSwitchPM#3c20629f to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inlineBotSwitchPM#3c20629f: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inlineBotSwitchPM#3c20629f: field start_param: %w", )
		}
		.StartParam = 
	}
	return nil
}

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

// GetStartParam returns value of StartParam field.
func ( *InlineBotSwitchPM) () ( string) {
	if  == nil {
		return
	}
	return .StartParam
}