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

// AttachMenuBotsBot represents TL type `attachMenuBotsBot#93bf667f`.
// Represents a bot mini app that can be launched from the attachment menu »¹
//
// Links:
//  1. https://core.telegram.org/api/bots/attach
//
// See https://core.telegram.org/constructor/attachMenuBotsBot for reference.
type AttachMenuBotsBot struct {
	// Represents a bot mini app that can be launched from the attachment menu »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/attach
	Bot AttachMenuBot
	// Info about related users and bots
	Users []UserClass
}

// AttachMenuBotsBotTypeID is TL type id of AttachMenuBotsBot.
const AttachMenuBotsBotTypeID = 0x93bf667f

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

func ( *AttachMenuBotsBot) () bool {
	if  == nil {
		return true
	}
	if !(.Bot.Zero()) {
		return false
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AttachMenuBotsBot from given interface.
func ( *AttachMenuBotsBot) ( interface {
	() ( AttachMenuBot)
	() ( []UserClass)
}) {
	.Bot = .()
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AttachMenuBotsBot) () tdp.Type {
	 := tdp.Type{
		Name: "attachMenuBotsBot",
		ID:   AttachMenuBotsBotTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AttachMenuBotsBot) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode attachMenuBotsBot#93bf667f as nil")
	}
	.PutID(AttachMenuBotsBotTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AttachMenuBotsBot) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode attachMenuBotsBot#93bf667f as nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode attachMenuBotsBot#93bf667f: field bot: %w", )
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode attachMenuBotsBot#93bf667f: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode attachMenuBotsBot#93bf667f: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AttachMenuBotsBot) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode attachMenuBotsBot#93bf667f to nil")
	}
	{
		if  := .Bot.Decode();  != nil {
			return fmt.Errorf("unable to decode attachMenuBotsBot#93bf667f: field bot: %w", )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode attachMenuBotsBot#93bf667f: field users: %w", )
		}

		if  > 0 {
			.Users = make([]UserClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeUser()
			if  != nil {
				return fmt.Errorf("unable to decode attachMenuBotsBot#93bf667f: field users: %w", )
			}
			.Users = append(.Users, )
		}
	}
	return nil
}

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

// GetUsers returns value of Users field.
func ( *AttachMenuBotsBot) () ( []UserClass) {
	if  == nil {
		return
	}
	return .Users
}

// MapUsers returns field Users wrapped in UserClassArray helper.
func ( *AttachMenuBotsBot) () ( UserClassArray) {
	return UserClassArray(.Users)
}