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

// PhoneInviteConferenceCallParticipantRequest represents TL type `phone.inviteConferenceCallParticipant#bcf22685`.
// Invite a user to a conference call¹.
//
// Links:
//  1. https://core.telegram.org/api/group-calls#conference-calls
//
// See https://core.telegram.org/method/phone.inviteConferenceCallParticipant for reference.
type PhoneInviteConferenceCallParticipantRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Invite the user to also turn on their video feed.
	Video bool
	// The conference call.
	Call InputGroupCallClass
	// The user to invite.
	UserID InputUserClass
}

// PhoneInviteConferenceCallParticipantRequestTypeID is TL type id of PhoneInviteConferenceCallParticipantRequest.
const PhoneInviteConferenceCallParticipantRequestTypeID = 0xbcf22685

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

func ( *PhoneInviteConferenceCallParticipantRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Video == false) {
		return false
	}
	if !(.Call == nil) {
		return false
	}
	if !(.UserID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneInviteConferenceCallParticipantRequest from given interface.
func ( *PhoneInviteConferenceCallParticipantRequest) ( interface {
	() ( bool)
	() ( InputGroupCallClass)
	() ( InputUserClass)
}) {
	.Video = .()
	.Call = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneInviteConferenceCallParticipantRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.inviteConferenceCallParticipant",
		ID:   PhoneInviteConferenceCallParticipantRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Video",
			SchemaName: "video",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PhoneInviteConferenceCallParticipantRequest) () {
	if !(.Video == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *PhoneInviteConferenceCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.inviteConferenceCallParticipant#bcf22685 as nil")
	}
	.PutID(PhoneInviteConferenceCallParticipantRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneInviteConferenceCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.inviteConferenceCallParticipant#bcf22685 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.inviteConferenceCallParticipant#bcf22685: field flags: %w", )
	}
	if .Call == nil {
		return fmt.Errorf("unable to encode phone.inviteConferenceCallParticipant#bcf22685: field call is nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.inviteConferenceCallParticipant#bcf22685: field call: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode phone.inviteConferenceCallParticipant#bcf22685: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.inviteConferenceCallParticipant#bcf22685: field user_id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneInviteConferenceCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.inviteConferenceCallParticipant#bcf22685 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.inviteConferenceCallParticipant#bcf22685: field flags: %w", )
		}
	}
	.Video = .Flags.Has(0)
	{
		,  := DecodeInputGroupCall()
		if  != nil {
			return fmt.Errorf("unable to decode phone.inviteConferenceCallParticipant#bcf22685: field call: %w", )
		}
		.Call = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode phone.inviteConferenceCallParticipant#bcf22685: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// SetVideo sets value of Video conditional field.
func ( *PhoneInviteConferenceCallParticipantRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Video = true
	} else {
		.Flags.Unset(0)
		.Video = false
	}
}

// GetVideo returns value of Video conditional field.
func ( *PhoneInviteConferenceCallParticipantRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

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

// GetUserID returns value of UserID field.
func ( *PhoneInviteConferenceCallParticipantRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// PhoneInviteConferenceCallParticipant invokes method phone.inviteConferenceCallParticipant#bcf22685 returning error if any.
// Invite a user to a conference call¹.
//
// Links:
//  1. https://core.telegram.org/api/group-calls#conference-calls
//
// Possible errors:
//
//	400 GROUPCALL_INVALID: The specified group call is invalid.
//
// See https://core.telegram.org/method/phone.inviteConferenceCallParticipant for reference.
func ( *Client) ( context.Context,  *PhoneInviteConferenceCallParticipantRequest) (UpdatesClass, error) {
	var  UpdatesBox

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