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

// PhoneCheckGroupCallRequest represents TL type `phone.checkGroupCall#b59cf977`.
// Check whether the group call Server Forwarding Unit is currently receiving the streams
// with the specified WebRTC source IDs.
// Returns an intersection of the source IDs specified in sources, and the source IDs
// currently being forwarded by the SFU.
//
// See https://core.telegram.org/method/phone.checkGroupCall for reference.
type PhoneCheckGroupCallRequest struct {
	// Group call
	Call InputGroupCall
	// Source IDs
	Sources []int
}

// PhoneCheckGroupCallRequestTypeID is TL type id of PhoneCheckGroupCallRequest.
const PhoneCheckGroupCallRequestTypeID = 0xb59cf977

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

func ( *PhoneCheckGroupCallRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Call.Zero()) {
		return false
	}
	if !(.Sources == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneCheckGroupCallRequest from given interface.
func ( *PhoneCheckGroupCallRequest) ( interface {
	() ( InputGroupCall)
	() ( []int)
}) {
	.Call = .()
	.Sources = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneCheckGroupCallRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.checkGroupCall",
		ID:   PhoneCheckGroupCallRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Sources",
			SchemaName: "sources",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneCheckGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.checkGroupCall#b59cf977 as nil")
	}
	.PutID(PhoneCheckGroupCallRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneCheckGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.checkGroupCall#b59cf977 as nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.checkGroupCall#b59cf977: field call: %w", )
	}
	.PutVectorHeader(len(.Sources))
	for ,  := range .Sources {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneCheckGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.checkGroupCall#b59cf977 to nil")
	}
	{
		if  := .Call.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.checkGroupCall#b59cf977: field call: %w", )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode phone.checkGroupCall#b59cf977: field sources: %w", )
		}

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

// GetCall returns value of Call field.
func ( *PhoneCheckGroupCallRequest) () ( InputGroupCall) {
	if  == nil {
		return
	}
	return .Call
}

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

// PhoneCheckGroupCall invokes method phone.checkGroupCall#b59cf977 returning error if any.
// Check whether the group call Server Forwarding Unit is currently receiving the streams
// with the specified WebRTC source IDs.
// Returns an intersection of the source IDs specified in sources, and the source IDs
// currently being forwarded by the SFU.
//
// Possible errors:
//
//	400 GROUPCALL_JOIN_MISSING: You haven't joined this group call.
//
// See https://core.telegram.org/method/phone.checkGroupCall for reference.
func ( *Client) ( context.Context,  *PhoneCheckGroupCallRequest) ([]int, error) {
	var  IntVector

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []int(.Elems), nil
}