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

// MessagesChatAdminsWithInvites represents TL type `messages.chatAdminsWithInvites#b69b72d7`.
// Info about chat invites generated by admins.
//
// See https://core.telegram.org/constructor/messages.chatAdminsWithInvites for reference.
type MessagesChatAdminsWithInvites struct {
	// Info about chat invites generated by admins.
	Admins []ChatAdminWithInvites
	// Mentioned users
	Users []UserClass
}

// MessagesChatAdminsWithInvitesTypeID is TL type id of MessagesChatAdminsWithInvites.
const MessagesChatAdminsWithInvitesTypeID = 0xb69b72d7

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

func ( *MessagesChatAdminsWithInvites) () bool {
	if  == nil {
		return true
	}
	if !(.Admins == nil) {
		return false
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesChatAdminsWithInvites from given interface.
func ( *MessagesChatAdminsWithInvites) ( interface {
	() ( []ChatAdminWithInvites)
	() ( []UserClass)
}) {
	.Admins = .()
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesChatAdminsWithInvites) () tdp.Type {
	 := tdp.Type{
		Name: "messages.chatAdminsWithInvites",
		ID:   MessagesChatAdminsWithInvitesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Admins",
			SchemaName: "admins",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesChatAdminsWithInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.chatAdminsWithInvites#b69b72d7 as nil")
	}
	.PutID(MessagesChatAdminsWithInvitesTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesChatAdminsWithInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.chatAdminsWithInvites#b69b72d7 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatAdminsWithInvites#b69b72d7: field admins: %w", )
		}

		if  > 0 {
			.Admins = make([]ChatAdminWithInvites, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  ChatAdminWithInvites
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.chatAdminsWithInvites#b69b72d7: field admins: %w", )
			}
			.Admins = append(.Admins, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.chatAdminsWithInvites#b69b72d7: field users: %w", )
		}

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

// GetAdmins returns value of Admins field.
func ( *MessagesChatAdminsWithInvites) () ( []ChatAdminWithInvites) {
	if  == nil {
		return
	}
	return .Admins
}

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

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