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

// PhoneEditGroupCallParticipantRequest represents TL type `phone.editGroupCallParticipant#a5273abf`.
// Edit information about a given group call participant
// Note: flags¹.N?Bool² parameters can have three possible values:
//
// Links:
//  1. https://core.telegram.org/mtproto/TL-combinators#conditional-fields
//  2. https://core.telegram.org/type/Bool
//
// See https://core.telegram.org/method/phone.editGroupCallParticipant for reference.
type PhoneEditGroupCallParticipantRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// The group call
	Call InputGroupCall
	// The group call participant (can also be the user itself)
	Participant InputPeerClass
	// Whether to mute or unmute the specified participant
	//
	// Use SetMuted and GetMuted helpers.
	Muted bool
	// New volume
	//
	// Use SetVolume and GetVolume helpers.
	Volume int
	// Raise or lower hand
	//
	// Use SetRaiseHand and GetRaiseHand helpers.
	RaiseHand bool
	// Start or stop the video stream
	//
	// Use SetVideoStopped and GetVideoStopped helpers.
	VideoStopped bool
	// Pause or resume the video stream
	//
	// Use SetVideoPaused and GetVideoPaused helpers.
	VideoPaused bool
	// Pause or resume the screen sharing stream
	//
	// Use SetPresentationPaused and GetPresentationPaused helpers.
	PresentationPaused bool
}

// PhoneEditGroupCallParticipantRequestTypeID is TL type id of PhoneEditGroupCallParticipantRequest.
const PhoneEditGroupCallParticipantRequestTypeID = 0xa5273abf

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

func ( *PhoneEditGroupCallParticipantRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Call.Zero()) {
		return false
	}
	if !(.Participant == nil) {
		return false
	}
	if !(.Muted == false) {
		return false
	}
	if !(.Volume == 0) {
		return false
	}
	if !(.RaiseHand == false) {
		return false
	}
	if !(.VideoStopped == false) {
		return false
	}
	if !(.VideoPaused == false) {
		return false
	}
	if !(.PresentationPaused == false) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneEditGroupCallParticipantRequest from given interface.
func ( *PhoneEditGroupCallParticipantRequest) ( interface {
	() ( InputGroupCall)
	() ( InputPeerClass)
	() ( bool,  bool)
	() ( int,  bool)
	() ( bool,  bool)
	() ( bool,  bool)
	() ( bool,  bool)
	() ( bool,  bool)
}) {
	.Call = .()
	.Participant = .()
	if ,  := .();  {
		.Muted = 
	}

	if ,  := .();  {
		.Volume = 
	}

	if ,  := .();  {
		.RaiseHand = 
	}

	if ,  := .();  {
		.VideoStopped = 
	}

	if ,  := .();  {
		.VideoPaused = 
	}

	if ,  := .();  {
		.PresentationPaused = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneEditGroupCallParticipantRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.editGroupCallParticipant",
		ID:   PhoneEditGroupCallParticipantRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Participant",
			SchemaName: "participant",
		},
		{
			Name:       "Muted",
			SchemaName: "muted",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Volume",
			SchemaName: "volume",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "RaiseHand",
			SchemaName: "raise_hand",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "VideoStopped",
			SchemaName: "video_stopped",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "VideoPaused",
			SchemaName: "video_paused",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "PresentationPaused",
			SchemaName: "presentation_paused",
			Null:       !.Flags.Has(5),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PhoneEditGroupCallParticipantRequest) () {
	if !(.Muted == false) {
		.Flags.Set(0)
	}
	if !(.Volume == 0) {
		.Flags.Set(1)
	}
	if !(.RaiseHand == false) {
		.Flags.Set(2)
	}
	if !(.VideoStopped == false) {
		.Flags.Set(3)
	}
	if !(.VideoPaused == false) {
		.Flags.Set(4)
	}
	if !(.PresentationPaused == false) {
		.Flags.Set(5)
	}
}

// Encode implements bin.Encoder.
func ( *PhoneEditGroupCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.editGroupCallParticipant#a5273abf as nil")
	}
	.PutID(PhoneEditGroupCallParticipantRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneEditGroupCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.editGroupCallParticipant#a5273abf as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.editGroupCallParticipant#a5273abf: field flags: %w", )
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.editGroupCallParticipant#a5273abf: field call: %w", )
	}
	if .Participant == nil {
		return fmt.Errorf("unable to encode phone.editGroupCallParticipant#a5273abf: field participant is nil")
	}
	if  := .Participant.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.editGroupCallParticipant#a5273abf: field participant: %w", )
	}
	if .Flags.Has(0) {
		.PutBool(.Muted)
	}
	if .Flags.Has(1) {
		.PutInt(.Volume)
	}
	if .Flags.Has(2) {
		.PutBool(.RaiseHand)
	}
	if .Flags.Has(3) {
		.PutBool(.VideoStopped)
	}
	if .Flags.Has(4) {
		.PutBool(.VideoPaused)
	}
	if .Flags.Has(5) {
		.PutBool(.PresentationPaused)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneEditGroupCallParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.editGroupCallParticipant#a5273abf to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field flags: %w", )
		}
	}
	{
		if  := .Call.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field call: %w", )
		}
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field participant: %w", )
		}
		.Participant = 
	}
	if .Flags.Has(0) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field muted: %w", )
		}
		.Muted = 
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field volume: %w", )
		}
		.Volume = 
	}
	if .Flags.Has(2) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field raise_hand: %w", )
		}
		.RaiseHand = 
	}
	if .Flags.Has(3) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field video_stopped: %w", )
		}
		.VideoStopped = 
	}
	if .Flags.Has(4) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field video_paused: %w", )
		}
		.VideoPaused = 
	}
	if .Flags.Has(5) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.editGroupCallParticipant#a5273abf: field presentation_paused: %w", )
		}
		.PresentationPaused = 
	}
	return nil
}

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

// GetParticipant returns value of Participant field.
func ( *PhoneEditGroupCallParticipantRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

// SetMuted sets value of Muted conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( bool) {
	.Flags.Set(0)
	.Muted = 
}

// GetMuted returns value of Muted conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Muted, true
}

// SetVolume sets value of Volume conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( int) {
	.Flags.Set(1)
	.Volume = 
}

// GetVolume returns value of Volume conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .Volume, true
}

// SetRaiseHand sets value of RaiseHand conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( bool) {
	.Flags.Set(2)
	.RaiseHand = 
}

// GetRaiseHand returns value of RaiseHand conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .RaiseHand, true
}

// SetVideoStopped sets value of VideoStopped conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( bool) {
	.Flags.Set(3)
	.VideoStopped = 
}

// GetVideoStopped returns value of VideoStopped conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .VideoStopped, true
}

// SetVideoPaused sets value of VideoPaused conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( bool) {
	.Flags.Set(4)
	.VideoPaused = 
}

// GetVideoPaused returns value of VideoPaused conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .VideoPaused, true
}

// SetPresentationPaused sets value of PresentationPaused conditional field.
func ( *PhoneEditGroupCallParticipantRequest) ( bool) {
	.Flags.Set(5)
	.PresentationPaused = 
}

// GetPresentationPaused returns value of PresentationPaused conditional field and
// boolean which is true if field was set.
func ( *PhoneEditGroupCallParticipantRequest) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .PresentationPaused, true
}

// PhoneEditGroupCallParticipant invokes method phone.editGroupCallParticipant#a5273abf returning error if any.
// Edit information about a given group call participant
// Note: flags¹.N?Bool² parameters can have three possible values:
//
// Links:
//  1. https://core.telegram.org/mtproto/TL-combinators#conditional-fields
//  2. https://core.telegram.org/type/Bool
//
// Possible errors:
//
//	403 GROUPCALL_FORBIDDEN: The group call has already ended.
//	400 PARTICIPANT_JOIN_MISSING: Trying to enable a presentation, when the user hasn't joined the Video Chat with phone.joinGroupCall.
//	400 USER_VOLUME_INVALID: The specified user volume is invalid.
//
// See https://core.telegram.org/method/phone.editGroupCallParticipant for reference.
func ( *Client) ( context.Context,  *PhoneEditGroupCallParticipantRequest) (UpdatesClass, error) {
	var  UpdatesBox

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