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

// PhoneInviteToGroupCallRequest represents TL type `phone.inviteToGroupCall#7b393160`.
// Invite a set of users to a group call.
//
// See https://core.telegram.org/method/phone.inviteToGroupCall for reference.
type PhoneInviteToGroupCallRequest struct {
	// The group call
	Call InputGroupCall
	// The users to invite.
	Users []InputUserClass
}

// PhoneInviteToGroupCallRequestTypeID is TL type id of PhoneInviteToGroupCallRequest.
const PhoneInviteToGroupCallRequestTypeID = 0x7b393160

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

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

	return true
}

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

// FillFrom fills PhoneInviteToGroupCallRequest from given interface.
func ( *PhoneInviteToGroupCallRequest) ( interface {
	() ( InputGroupCall)
	() ( []InputUserClass)
}) {
	.Call = .()
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneInviteToGroupCallRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.inviteToGroupCall",
		ID:   PhoneInviteToGroupCallRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneInviteToGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.inviteToGroupCall#7b393160 as nil")
	}
	.PutID(PhoneInviteToGroupCallRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneInviteToGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.inviteToGroupCall#7b393160 as nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.inviteToGroupCall#7b393160: field call: %w", )
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode phone.inviteToGroupCall#7b393160: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode phone.inviteToGroupCall#7b393160: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

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

		if  > 0 {
			.Users = make([]InputUserClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputUser()
			if  != nil {
				return fmt.Errorf("unable to decode phone.inviteToGroupCall#7b393160: field users: %w", )
			}
			.Users = append(.Users, )
		}
	}
	return nil
}

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

// GetUsers returns value of Users field.
func ( *PhoneInviteToGroupCallRequest) () ( []InputUserClass) {
	if  == nil {
		return
	}
	return .Users
}

// MapUsers returns field Users wrapped in InputUserClassArray helper.
func ( *PhoneInviteToGroupCallRequest) () ( InputUserClassArray) {
	return InputUserClassArray(.Users)
}

// PhoneInviteToGroupCall invokes method phone.inviteToGroupCall#7b393160 returning error if any.
// Invite a set of users to a group call.
//
// Possible errors:
//
//	403 GROUPCALL_FORBIDDEN: The group call has already ended.
//	400 GROUPCALL_INVALID: The specified group call is invalid.
//	400 INVITE_FORBIDDEN_WITH_JOINAS: If the user has anonymously joined a group call as a channel, they can't invite other users to the group call because that would cause deanonymization, because the invite would be sent using the original user ID, not the anonymized channel ID.
//	400 USER_ALREADY_INVITED: You have already invited this user.
//
// See https://core.telegram.org/method/phone.inviteToGroupCall for reference.
func ( *Client) ( context.Context,  *PhoneInviteToGroupCallRequest) (UpdatesClass, error) {
	var  UpdatesBox

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