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

// DialogPeerClassVector is a box for Vector<DialogPeer>
type DialogPeerClassVector struct {
	// Elements of Vector<DialogPeer>
	Elems []DialogPeerClass
}

// DialogPeerClassVectorTypeID is TL type id of DialogPeerClassVector.
const DialogPeerClassVectorTypeID = bin.TypeVector

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

func ( *DialogPeerClassVector) () bool {
	if  == nil {
		return true
	}
	if !(.Elems == nil) {
		return false
	}

	return true
}

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

// FillFrom fills DialogPeerClassVector from given interface.
func ( *DialogPeerClassVector) ( interface {
	() ( []DialogPeerClass)
}) {
	.Elems = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *DialogPeerClassVector) () tdp.Type {
	 := tdp.Type{
		Name: "",
		ID:   DialogPeerClassVectorTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Elems",
			SchemaName: "Elems",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *DialogPeerClassVector) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode Vector<DialogPeer> as nil")
	}

	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *DialogPeerClassVector) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode Vector<DialogPeer> as nil")
	}
	.PutVectorHeader(len(.Elems))
	for ,  := range .Elems {
		if  == nil {
			return fmt.Errorf("unable to encode Vector<DialogPeer>: field Elems element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode Vector<DialogPeer>: field Elems element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *DialogPeerClassVector) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode Vector<DialogPeer> to nil")
	}

	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *DialogPeerClassVector) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode Vector<DialogPeer> to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode Vector<DialogPeer>: field Elems: %w", )
		}

		if  > 0 {
			.Elems = make([]DialogPeerClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeDialogPeer()
			if  != nil {
				return fmt.Errorf("unable to decode Vector<DialogPeer>: field Elems: %w", )
			}
			.Elems = append(.Elems, )
		}
	}
	return nil
}

// GetElems returns value of Elems field.
func ( *DialogPeerClassVector) () ( []DialogPeerClass) {
	if  == nil {
		return
	}
	return .Elems
}

// MapElems returns field Elems wrapped in DialogPeerClassArray helper.
func ( *DialogPeerClassVector) () ( DialogPeerClassArray) {
	return DialogPeerClassArray(.Elems)
}