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

// PhoneGroupCallStreamChannels represents TL type `phone.groupCallStreamChannels#d0e482b2`.
// Info about RTMP streams in a group call or livestream
//
// See https://core.telegram.org/constructor/phone.groupCallStreamChannels for reference.
type PhoneGroupCallStreamChannels struct {
	// RTMP streams
	Channels []GroupCallStreamChannel
}

// PhoneGroupCallStreamChannelsTypeID is TL type id of PhoneGroupCallStreamChannels.
const PhoneGroupCallStreamChannelsTypeID = 0xd0e482b2

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

func ( *PhoneGroupCallStreamChannels) () bool {
	if  == nil {
		return true
	}
	if !(.Channels == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneGroupCallStreamChannels from given interface.
func ( *PhoneGroupCallStreamChannels) ( interface {
	() ( []GroupCallStreamChannel)
}) {
	.Channels = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneGroupCallStreamChannels) () tdp.Type {
	 := tdp.Type{
		Name: "phone.groupCallStreamChannels",
		ID:   PhoneGroupCallStreamChannelsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channels",
			SchemaName: "channels",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneGroupCallStreamChannels) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.groupCallStreamChannels#d0e482b2 as nil")
	}
	.PutID(PhoneGroupCallStreamChannelsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneGroupCallStreamChannels) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.groupCallStreamChannels#d0e482b2 as nil")
	}
	.PutVectorHeader(len(.Channels))
	for ,  := range .Channels {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode phone.groupCallStreamChannels#d0e482b2: field channels element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *PhoneGroupCallStreamChannels) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.groupCallStreamChannels#d0e482b2 to nil")
	}
	if  := .ConsumeID(PhoneGroupCallStreamChannelsTypeID);  != nil {
		return fmt.Errorf("unable to decode phone.groupCallStreamChannels#d0e482b2: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PhoneGroupCallStreamChannels) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.groupCallStreamChannels#d0e482b2 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode phone.groupCallStreamChannels#d0e482b2: field channels: %w", )
		}

		if  > 0 {
			.Channels = make([]GroupCallStreamChannel, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  GroupCallStreamChannel
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode phone.groupCallStreamChannels#d0e482b2: field channels: %w", )
			}
			.Channels = append(.Channels, )
		}
	}
	return nil
}

// GetChannels returns value of Channels field.
func ( *PhoneGroupCallStreamChannels) () ( []GroupCallStreamChannel) {
	if  == nil {
		return
	}
	return .Channels
}