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

// MessagesExportedChatInvites represents TL type `messages.exportedChatInvites#bdc62dcc`.
// Info about chat invites exported by a certain admin.
//
// See https://core.telegram.org/constructor/messages.exportedChatInvites for reference.
type MessagesExportedChatInvites struct {
	// Number of invites exported by the admin
	Count int
	// Exported invites
	Invites []ExportedChatInviteClass
	// Info about the admin
	Users []UserClass
}

// MessagesExportedChatInvitesTypeID is TL type id of MessagesExportedChatInvites.
const MessagesExportedChatInvitesTypeID = 0xbdc62dcc

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

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

	return true
}

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

// FillFrom fills MessagesExportedChatInvites from given interface.
func ( *MessagesExportedChatInvites) ( interface {
	() ( int)
	() ( []ExportedChatInviteClass)
	() ( []UserClass)
}) {
	.Count = .()
	.Invites = .()
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesExportedChatInvites) () tdp.Type {
	 := tdp.Type{
		Name: "messages.exportedChatInvites",
		ID:   MessagesExportedChatInvitesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Count",
			SchemaName: "count",
		},
		{
			Name:       "Invites",
			SchemaName: "invites",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesExportedChatInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.exportedChatInvites#bdc62dcc as nil")
	}
	.PutID(MessagesExportedChatInvitesTypeID)
	return .EncodeBare()
}

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

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

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

		if  > 0 {
			.Invites = make([]ExportedChatInviteClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeExportedChatInvite()
			if  != nil {
				return fmt.Errorf("unable to decode messages.exportedChatInvites#bdc62dcc: field invites: %w", )
			}
			.Invites = append(.Invites, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.exportedChatInvites#bdc62dcc: field users: %w", )
		}

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

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

// GetInvites returns value of Invites field.
func ( *MessagesExportedChatInvites) () ( []ExportedChatInviteClass) {
	if  == nil {
		return
	}
	return .Invites
}

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

// MapInvites returns field Invites wrapped in ExportedChatInviteClassArray helper.
func ( *MessagesExportedChatInvites) () ( ExportedChatInviteClassArray) {
	return ExportedChatInviteClassArray(.Invites)
}

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