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

// HelpRecentMeURLs represents TL type `help.recentMeUrls#e0310d7`.
// Recent t.me URLs
//
// See https://core.telegram.org/constructor/help.recentMeUrls for reference.
type HelpRecentMeURLs struct {
	// URLs
	URLs []RecentMeURLClass
	// Chats
	Chats []ChatClass
	// Users
	Users []UserClass
}

// HelpRecentMeURLsTypeID is TL type id of HelpRecentMeURLs.
const HelpRecentMeURLsTypeID = 0xe0310d7

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

func ( *HelpRecentMeURLs) () bool {
	if  == nil {
		return true
	}
	if !(.URLs == nil) {
		return false
	}
	if !(.Chats == nil) {
		return false
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills HelpRecentMeURLs from given interface.
func ( *HelpRecentMeURLs) ( interface {
	() ( []RecentMeURLClass)
	() ( []ChatClass)
	() ( []UserClass)
}) {
	.URLs = .()
	.Chats = .()
	.Users = .()
}

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

// TypeName returns name of type in TL schema.
func (*HelpRecentMeURLs) () string {
	return "help.recentMeUrls"
}

// TypeInfo returns info about TL type.
func ( *HelpRecentMeURLs) () tdp.Type {
	 := tdp.Type{
		Name: "help.recentMeUrls",
		ID:   HelpRecentMeURLsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URLs",
			SchemaName: "urls",
		},
		{
			Name:       "Chats",
			SchemaName: "chats",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpRecentMeURLs) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.recentMeUrls#e0310d7 as nil")
	}
	.PutID(HelpRecentMeURLsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpRecentMeURLs) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.recentMeUrls#e0310d7 as nil")
	}
	.PutVectorHeader(len(.URLs))
	for ,  := range .URLs {
		if  == nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field urls element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field urls element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Chats))
	for ,  := range .Chats {
		if  == nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field chats element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field chats element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode help.recentMeUrls#e0310d7: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *HelpRecentMeURLs) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.recentMeUrls#e0310d7 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode help.recentMeUrls#e0310d7: field urls: %w", )
		}

		if  > 0 {
			.URLs = make([]RecentMeURLClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeRecentMeURL()
			if  != nil {
				return fmt.Errorf("unable to decode help.recentMeUrls#e0310d7: field urls: %w", )
			}
			.URLs = append(.URLs, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode help.recentMeUrls#e0310d7: field chats: %w", )
		}

		if  > 0 {
			.Chats = make([]ChatClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeChat()
			if  != nil {
				return fmt.Errorf("unable to decode help.recentMeUrls#e0310d7: field chats: %w", )
			}
			.Chats = append(.Chats, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode help.recentMeUrls#e0310d7: field users: %w", )
		}

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

// GetURLs returns value of URLs field.
func ( *HelpRecentMeURLs) () ( []RecentMeURLClass) {
	if  == nil {
		return
	}
	return .URLs
}

// GetChats returns value of Chats field.
func ( *HelpRecentMeURLs) () ( []ChatClass) {
	if  == nil {
		return
	}
	return .Chats
}

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

// MapURLs returns field URLs wrapped in RecentMeURLClassArray helper.
func ( *HelpRecentMeURLs) () ( RecentMeURLClassArray) {
	return RecentMeURLClassArray(.URLs)
}

// MapChats returns field Chats wrapped in ChatClassArray helper.
func ( *HelpRecentMeURLs) () ( ChatClassArray) {
	return ChatClassArray(.Chats)
}

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