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

// UsersUserFull represents TL type `users.userFull#3b6d152e`.
// Full user information
//
// See https://core.telegram.org/constructor/users.userFull for reference.
type UsersUserFull struct {
	// Full user information
	FullUser UserFull
	// Mentioned chats
	Chats []ChatClass
	// Mentioned users
	Users []UserClass
}

// UsersUserFullTypeID is TL type id of UsersUserFull.
const UsersUserFullTypeID = 0x3b6d152e

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

func ( *UsersUserFull) () bool {
	if  == nil {
		return true
	}
	if !(.FullUser.Zero()) {
		return false
	}
	if !(.Chats == nil) {
		return false
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills UsersUserFull from given interface.
func ( *UsersUserFull) ( interface {
	() ( UserFull)
	() ( []ChatClass)
	() ( []UserClass)
}) {
	.FullUser = .()
	.Chats = .()
	.Users = .()
}

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

// TypeName returns name of type in TL schema.
func (*UsersUserFull) () string {
	return "users.userFull"
}

// TypeInfo returns info about TL type.
func ( *UsersUserFull) () tdp.Type {
	 := tdp.Type{
		Name: "users.userFull",
		ID:   UsersUserFullTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FullUser",
			SchemaName: "full_user",
		},
		{
			Name:       "Chats",
			SchemaName: "chats",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UsersUserFull) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode users.userFull#3b6d152e as nil")
	}
	.PutID(UsersUserFullTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *UsersUserFull) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode users.userFull#3b6d152e to nil")
	}
	{
		if  := .FullUser.Decode();  != nil {
			return fmt.Errorf("unable to decode users.userFull#3b6d152e: field full_user: %w", )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode users.userFull#3b6d152e: field chats: %w", )
		}

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

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

// GetFullUser returns value of FullUser field.
func ( *UsersUserFull) () ( UserFull) {
	if  == nil {
		return
	}
	return .FullUser
}

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

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

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

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