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

// MessagesChatInviteImporters represents TL type `messages.chatInviteImporters#81b6b00a`.
// Info about the users that joined the chat using a specific chat invite
//
// See https://core.telegram.org/constructor/messages.chatInviteImporters for reference.
type MessagesChatInviteImporters struct {
	// Number of users that joined
	Count int
	// The users that joined
	Importers []ChatInviteImporter
	// The users that joined
	Users []UserClass
}

// MessagesChatInviteImportersTypeID is TL type id of MessagesChatInviteImporters.
const MessagesChatInviteImportersTypeID = 0x81b6b00a

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

func ( *MessagesChatInviteImporters) () bool {
	if  == nil {
		return true
	}
	if !(.Count == 0) {
		return false
	}
	if !(.Importers == nil) {
		return false
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesChatInviteImporters from given interface.
func ( *MessagesChatInviteImporters) ( interface {
	() ( int)
	() ( []ChatInviteImporter)
	() ( []UserClass)
}) {
	.Count = .()
	.Importers = .()
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesChatInviteImporters) () tdp.Type {
	 := tdp.Type{
		Name: "messages.chatInviteImporters",
		ID:   MessagesChatInviteImportersTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Count",
			SchemaName: "count",
		},
		{
			Name:       "Importers",
			SchemaName: "importers",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesChatInviteImporters) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.chatInviteImporters#81b6b00a as nil")
	}
	.PutID(MessagesChatInviteImportersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesChatInviteImporters) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.chatInviteImporters#81b6b00a as nil")
	}
	.PutInt(.Count)
	.PutVectorHeader(len(.Importers))
	for ,  := range .Importers {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.chatInviteImporters#81b6b00a: field importers element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode messages.chatInviteImporters#81b6b00a: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.chatInviteImporters#81b6b00a: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesChatInviteImporters) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.chatInviteImporters#81b6b00a to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatInviteImporters#81b6b00a: field count: %w", )
		}
		.Count = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatInviteImporters#81b6b00a: field importers: %w", )
		}

		if  > 0 {
			.Importers = make([]ChatInviteImporter, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  ChatInviteImporter
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.chatInviteImporters#81b6b00a: field importers: %w", )
			}
			.Importers = append(.Importers, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatInviteImporters#81b6b00a: field users: %w", )
		}

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

// GetCount returns value of Count field.
func ( *MessagesChatInviteImporters) () ( int) {
	if  == nil {
		return
	}
	return .Count
}

// GetImporters returns value of Importers field.
func ( *MessagesChatInviteImporters) () ( []ChatInviteImporter) {
	if  == nil {
		return
	}
	return .Importers
}

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

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