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

// GroupCallParticipantVideoSourceGroup represents TL type `groupCallParticipantVideoSourceGroup#dcb118b7`.
// Describes a group of video synchronization source identifiers
//
// See https://core.telegram.org/constructor/groupCallParticipantVideoSourceGroup for reference.
type GroupCallParticipantVideoSourceGroup struct {
	// SDP semantics
	Semantics string
	// Source IDs
	Sources []int
}

// GroupCallParticipantVideoSourceGroupTypeID is TL type id of GroupCallParticipantVideoSourceGroup.
const GroupCallParticipantVideoSourceGroupTypeID = 0xdcb118b7

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

func ( *GroupCallParticipantVideoSourceGroup) () bool {
	if  == nil {
		return true
	}
	if !(.Semantics == "") {
		return false
	}
	if !(.Sources == nil) {
		return false
	}

	return true
}

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

// FillFrom fills GroupCallParticipantVideoSourceGroup from given interface.
func ( *GroupCallParticipantVideoSourceGroup) ( interface {
	() ( string)
	() ( []int)
}) {
	.Semantics = .()
	.Sources = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *GroupCallParticipantVideoSourceGroup) () tdp.Type {
	 := tdp.Type{
		Name: "groupCallParticipantVideoSourceGroup",
		ID:   GroupCallParticipantVideoSourceGroupTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Semantics",
			SchemaName: "semantics",
		},
		{
			Name:       "Sources",
			SchemaName: "sources",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *GroupCallParticipantVideoSourceGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallParticipantVideoSourceGroup#dcb118b7 as nil")
	}
	.PutID(GroupCallParticipantVideoSourceGroupTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *GroupCallParticipantVideoSourceGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallParticipantVideoSourceGroup#dcb118b7 as nil")
	}
	.PutString(.Semantics)
	.PutVectorHeader(len(.Sources))
	for ,  := range .Sources {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *GroupCallParticipantVideoSourceGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode groupCallParticipantVideoSourceGroup#dcb118b7 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field semantics: %w", )
		}
		.Semantics = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field sources: %w", )
		}

		if  > 0 {
			.Sources = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field sources: %w", )
			}
			.Sources = append(.Sources, )
		}
	}
	return nil
}

// GetSemantics returns value of Semantics field.
func ( *GroupCallParticipantVideoSourceGroup) () ( string) {
	if  == nil {
		return
	}
	return .Semantics
}

// GetSources returns value of Sources field.
func ( *GroupCallParticipantVideoSourceGroup) () ( []int) {
	if  == nil {
		return
	}
	return .Sources
}