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

// PhoneGetGroupParticipantsRequest represents TL type `phone.getGroupParticipants#c558d8ab`.
// Get group call participants
//
// See https://core.telegram.org/method/phone.getGroupParticipants for reference.
type PhoneGetGroupParticipantsRequest struct {
	// Group call
	Call InputGroupCall
	// If specified, will fetch group participant info about the specified peers
	IDs []InputPeerClass
	// If specified, will fetch group participant info about the specified WebRTC source IDs
	Sources []int
	// Offset for results, taken from the next_offset field of phone.groupParticipantsĀ¹,
	// initially an empty string. Note: if no more results are available, the method call
	// will return an empty next_offset; thus, avoid providing the next_offset returned in
	// phone.groupParticipantsĀ² if it is empty, to avoid an infinite loop.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/phone.groupParticipants
	//  2) https://core.telegram.org/constructor/phone.groupParticipants
	Offset string
	// Maximum number of results to return, see paginationĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// PhoneGetGroupParticipantsRequestTypeID is TL type id of PhoneGetGroupParticipantsRequest.
const PhoneGetGroupParticipantsRequestTypeID = 0xc558d8ab

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

func ( *PhoneGetGroupParticipantsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Call.Zero()) {
		return false
	}
	if !(.IDs == nil) {
		return false
	}
	if !(.Sources == nil) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneGetGroupParticipantsRequest from given interface.
func ( *PhoneGetGroupParticipantsRequest) ( interface {
	() ( InputGroupCall)
	() ( []InputPeerClass)
	() ( []int)
	() ( string)
	() ( int)
}) {
	.Call = .()
	.IDs = .()
	.Sources = .()
	.Offset = .()
	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneGetGroupParticipantsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.getGroupParticipants",
		ID:   PhoneGetGroupParticipantsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "IDs",
			SchemaName: "ids",
		},
		{
			Name:       "Sources",
			SchemaName: "sources",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneGetGroupParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.getGroupParticipants#c558d8ab as nil")
	}
	.PutID(PhoneGetGroupParticipantsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneGetGroupParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.getGroupParticipants#c558d8ab as nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field call: %w", )
	}
	.PutVectorHeader(len(.IDs))
	for ,  := range .IDs {
		if  == nil {
			return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Sources))
	for ,  := range .Sources {
		.PutInt()
	}
	.PutString(.Offset)
	.PutInt(.Limit)
	return nil
}

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

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

		if  > 0 {
			.IDs = make([]InputPeerClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputPeer()
			if  != nil {
				return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field ids: %w", )
			}
			.IDs = append(.IDs, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field sources: %w", )
		}

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

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

// GetIDs returns value of IDs field.
func ( *PhoneGetGroupParticipantsRequest) () ( []InputPeerClass) {
	if  == nil {
		return
	}
	return .IDs
}

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

// GetOffset returns value of Offset field.
func ( *PhoneGetGroupParticipantsRequest) () ( string) {
	if  == nil {
		return
	}
	return .Offset
}

// GetLimit returns value of Limit field.
func ( *PhoneGetGroupParticipantsRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// MapIDs returns field IDs wrapped in InputPeerClassArray helper.
func ( *PhoneGetGroupParticipantsRequest) () ( InputPeerClassArray) {
	return InputPeerClassArray(.IDs)
}

// PhoneGetGroupParticipants invokes method phone.getGroupParticipants#c558d8ab returning error if any.
// Get group call participants
//
// See https://core.telegram.org/method/phone.getGroupParticipants for reference.
func ( *Client) ( context.Context,  *PhoneGetGroupParticipantsRequest) (*PhoneGroupParticipants, error) {
	var  PhoneGroupParticipants

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