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

// MessagesChatFull represents TL type `messages.chatFull#e5d7d19c`.
// Full info about a channel¹, supergroup², gigagroup³ or basic group⁴.
//
// Links:
//  1. https://core.telegram.org/api/channel#channels
//  2. https://core.telegram.org/api/channel#supergroups
//  3. https://core.telegram.org/api/channel#gigagroups
//  4. https://core.telegram.org/api/channel#basic-groups
//
// See https://core.telegram.org/constructor/messages.chatFull for reference.
type MessagesChatFull struct {
	// Full info
	FullChat ChatFullClass
	// Mentioned chats
	Chats []ChatClass
	// Mentioned users
	Users []UserClass
}

// MessagesChatFullTypeID is TL type id of MessagesChatFull.
const MessagesChatFullTypeID = 0xe5d7d19c

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

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

	return true
}

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

// FillFrom fills MessagesChatFull from given interface.
func ( *MessagesChatFull) ( interface {
	() ( ChatFullClass)
	() ( []ChatClass)
	() ( []UserClass)
}) {
	.FullChat = .()
	.Chats = .()
	.Users = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesChatFull) () string {
	return "messages.chatFull"
}

// TypeInfo returns info about TL type.
func ( *MessagesChatFull) () tdp.Type {
	 := tdp.Type{
		Name: "messages.chatFull",
		ID:   MessagesChatFullTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FullChat",
			SchemaName: "full_chat",
		},
		{
			Name:       "Chats",
			SchemaName: "chats",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesChatFull) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.chatFull#e5d7d19c as nil")
	}
	.PutID(MessagesChatFullTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *MessagesChatFull) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.chatFull#e5d7d19c to nil")
	}
	if  := .ConsumeID(MessagesChatFullTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.chatFull#e5d7d19c: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesChatFull) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.chatFull#e5d7d19c to nil")
	}
	{
		,  := DecodeChatFull()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatFull#e5d7d19c: field full_chat: %w", )
		}
		.FullChat = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatFull#e5d7d19c: field chats: %w", )
		}

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

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

// GetFullChat returns value of FullChat field.
func ( *MessagesChatFull) () ( ChatFullClass) {
	if  == nil {
		return
	}
	return .FullChat
}

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

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

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

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