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

// StarsGiveawayOptionVector is a box for Vector<StarsGiveawayOption>
type StarsGiveawayOptionVector struct {
	// Elements of Vector<StarsGiveawayOption>
	Elems []StarsGiveawayOption
}

// StarsGiveawayOptionVectorTypeID is TL type id of StarsGiveawayOptionVector.
const StarsGiveawayOptionVectorTypeID = bin.TypeVector

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

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

	return true
}

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

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

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

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

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

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

	return .EncodeBare()
}

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

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

	return .DecodeBare()
}

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

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

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