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

// GroupCallParticipant represents TL type `groupCallParticipant#eba636fe`.
// Info about a group call participant
//
// See https://core.telegram.org/constructor/groupCallParticipant for reference.
type GroupCallParticipant struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the participant is muted
	Muted bool
	// Whether the participant has left
	Left bool
	// Whether the participant can unmute themselves
	CanSelfUnmute bool
	// Whether the participant has just joined
	JustJoined bool
	// If set, and updateGroupCallParticipants¹.version < locally stored call.version, info
	// about this participant should be ignored. If (...), and updateGroupCallParticipants²
	// version > call.version+1, the participant list should be refetched using phone
	// getGroupParticipants³.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/updateGroupCallParticipants
	//  2) https://core.telegram.org/constructor/updateGroupCallParticipants
	//  3) https://core.telegram.org/method/phone.getGroupParticipants
	Versioned bool
	// If not set, the volume and muted_by_you fields can be safely used to overwrite locally
	// cached information; otherwise, volume will contain valid information only if
	// volume_by_admin is set both in the cache and in the received constructor.
	Min bool
	// Whether this participant was muted by the current user
	MutedByYou bool
	// Whether our volume can only changed by an admin
	VolumeByAdmin bool
	// Whether this participant is the current user
	Self bool
	// Whether this participant is currently broadcasting video
	VideoJoined bool
	// Peer information
	Peer PeerClass
	// When did this participant join the group call
	Date int
	// When was this participant last active in the group call
	//
	// Use SetActiveDate and GetActiveDate helpers.
	ActiveDate int
	// Source ID
	Source int
	// Volume, if not set the volume is set to 100%.
	//
	// Use SetVolume and GetVolume helpers.
	Volume int
	// Info about this participant
	//
	// Use SetAbout and GetAbout helpers.
	About string
	// Specifies the UI visualization order of peers with raised hands: peers with a higher
	// rating should be showed first in the list.
	//
	// Use SetRaiseHandRating and GetRaiseHandRating helpers.
	RaiseHandRating int64
	// Info about the video stream the participant is currently broadcasting
	//
	// Use SetVideo and GetVideo helpers.
	Video GroupCallParticipantVideo
	// Info about the screen sharing stream the participant is currently broadcasting
	//
	// Use SetPresentation and GetPresentation helpers.
	Presentation GroupCallParticipantVideo
}

// GroupCallParticipantTypeID is TL type id of GroupCallParticipant.
const GroupCallParticipantTypeID = 0xeba636fe

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

func ( *GroupCallParticipant) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Muted == false) {
		return false
	}
	if !(.Left == false) {
		return false
	}
	if !(.CanSelfUnmute == false) {
		return false
	}
	if !(.JustJoined == false) {
		return false
	}
	if !(.Versioned == false) {
		return false
	}
	if !(.Min == false) {
		return false
	}
	if !(.MutedByYou == false) {
		return false
	}
	if !(.VolumeByAdmin == false) {
		return false
	}
	if !(.Self == false) {
		return false
	}
	if !(.VideoJoined == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Date == 0) {
		return false
	}
	if !(.ActiveDate == 0) {
		return false
	}
	if !(.Source == 0) {
		return false
	}
	if !(.Volume == 0) {
		return false
	}
	if !(.About == "") {
		return false
	}
	if !(.RaiseHandRating == 0) {
		return false
	}
	if !(.Video.Zero()) {
		return false
	}
	if !(.Presentation.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills GroupCallParticipant from given interface.
func ( *GroupCallParticipant) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( PeerClass)
	() ( int)
	() ( int,  bool)
	() ( int)
	() ( int,  bool)
	() ( string,  bool)
	() ( int64,  bool)
	() ( GroupCallParticipantVideo,  bool)
	() ( GroupCallParticipantVideo,  bool)
}) {
	.Muted = .()
	.Left = .()
	.CanSelfUnmute = .()
	.JustJoined = .()
	.Versioned = .()
	.Min = .()
	.MutedByYou = .()
	.VolumeByAdmin = .()
	.Self = .()
	.VideoJoined = .()
	.Peer = .()
	.Date = .()
	if ,  := .();  {
		.ActiveDate = 
	}

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

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

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

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

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

}

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

// TypeName returns name of type in TL schema.
func (*GroupCallParticipant) () string {
	return "groupCallParticipant"
}

// TypeInfo returns info about TL type.
func ( *GroupCallParticipant) () tdp.Type {
	 := tdp.Type{
		Name: "groupCallParticipant",
		ID:   GroupCallParticipantTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Muted",
			SchemaName: "muted",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Left",
			SchemaName: "left",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "CanSelfUnmute",
			SchemaName: "can_self_unmute",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "JustJoined",
			SchemaName: "just_joined",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Versioned",
			SchemaName: "versioned",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Min",
			SchemaName: "min",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "MutedByYou",
			SchemaName: "muted_by_you",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "VolumeByAdmin",
			SchemaName: "volume_by_admin",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Self",
			SchemaName: "self",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "VideoJoined",
			SchemaName: "video_joined",
			Null:       !.Flags.Has(15),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "ActiveDate",
			SchemaName: "active_date",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Source",
			SchemaName: "source",
		},
		{
			Name:       "Volume",
			SchemaName: "volume",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "About",
			SchemaName: "about",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "RaiseHandRating",
			SchemaName: "raise_hand_rating",
			Null:       !.Flags.Has(13),
		},
		{
			Name:       "Video",
			SchemaName: "video",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "Presentation",
			SchemaName: "presentation",
			Null:       !.Flags.Has(14),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *GroupCallParticipant) () {
	if !(.Muted == false) {
		.Flags.Set(0)
	}
	if !(.Left == false) {
		.Flags.Set(1)
	}
	if !(.CanSelfUnmute == false) {
		.Flags.Set(2)
	}
	if !(.JustJoined == false) {
		.Flags.Set(4)
	}
	if !(.Versioned == false) {
		.Flags.Set(5)
	}
	if !(.Min == false) {
		.Flags.Set(8)
	}
	if !(.MutedByYou == false) {
		.Flags.Set(9)
	}
	if !(.VolumeByAdmin == false) {
		.Flags.Set(10)
	}
	if !(.Self == false) {
		.Flags.Set(12)
	}
	if !(.VideoJoined == false) {
		.Flags.Set(15)
	}
	if !(.ActiveDate == 0) {
		.Flags.Set(3)
	}
	if !(.Volume == 0) {
		.Flags.Set(7)
	}
	if !(.About == "") {
		.Flags.Set(11)
	}
	if !(.RaiseHandRating == 0) {
		.Flags.Set(13)
	}
	if !(.Video.Zero()) {
		.Flags.Set(6)
	}
	if !(.Presentation.Zero()) {
		.Flags.Set(14)
	}
}

// Encode implements bin.Encoder.
func ( *GroupCallParticipant) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallParticipant#eba636fe as nil")
	}
	.PutID(GroupCallParticipantTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *GroupCallParticipant) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallParticipant#eba636fe as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode groupCallParticipant#eba636fe: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode groupCallParticipant#eba636fe: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode groupCallParticipant#eba636fe: field peer: %w", )
	}
	.PutInt(.Date)
	if .Flags.Has(3) {
		.PutInt(.ActiveDate)
	}
	.PutInt(.Source)
	if .Flags.Has(7) {
		.PutInt(.Volume)
	}
	if .Flags.Has(11) {
		.PutString(.About)
	}
	if .Flags.Has(13) {
		.PutLong(.RaiseHandRating)
	}
	if .Flags.Has(6) {
		if  := .Video.Encode();  != nil {
			return fmt.Errorf("unable to encode groupCallParticipant#eba636fe: field video: %w", )
		}
	}
	if .Flags.Has(14) {
		if  := .Presentation.Encode();  != nil {
			return fmt.Errorf("unable to encode groupCallParticipant#eba636fe: field presentation: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *GroupCallParticipant) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode groupCallParticipant#eba636fe to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field flags: %w", )
		}
	}
	.Muted = .Flags.Has(0)
	.Left = .Flags.Has(1)
	.CanSelfUnmute = .Flags.Has(2)
	.JustJoined = .Flags.Has(4)
	.Versioned = .Flags.Has(5)
	.Min = .Flags.Has(8)
	.MutedByYou = .Flags.Has(9)
	.VolumeByAdmin = .Flags.Has(10)
	.Self = .Flags.Has(12)
	.VideoJoined = .Flags.Has(15)
	{
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field date: %w", )
		}
		.Date = 
	}
	if .Flags.Has(3) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field active_date: %w", )
		}
		.ActiveDate = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field source: %w", )
		}
		.Source = 
	}
	if .Flags.Has(7) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field volume: %w", )
		}
		.Volume = 
	}
	if .Flags.Has(11) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field about: %w", )
		}
		.About = 
	}
	if .Flags.Has(13) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field raise_hand_rating: %w", )
		}
		.RaiseHandRating = 
	}
	if .Flags.Has(6) {
		if  := .Video.Decode();  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field video: %w", )
		}
	}
	if .Flags.Has(14) {
		if  := .Presentation.Decode();  != nil {
			return fmt.Errorf("unable to decode groupCallParticipant#eba636fe: field presentation: %w", )
		}
	}
	return nil
}

// SetMuted sets value of Muted conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(0)
		.Muted = true
	} else {
		.Flags.Unset(0)
		.Muted = false
	}
}

// GetMuted returns value of Muted conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetLeft sets value of Left conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(1)
		.Left = true
	} else {
		.Flags.Unset(1)
		.Left = false
	}
}

// GetLeft returns value of Left conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetCanSelfUnmute sets value of CanSelfUnmute conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(2)
		.CanSelfUnmute = true
	} else {
		.Flags.Unset(2)
		.CanSelfUnmute = false
	}
}

// GetCanSelfUnmute returns value of CanSelfUnmute conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetJustJoined sets value of JustJoined conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(4)
		.JustJoined = true
	} else {
		.Flags.Unset(4)
		.JustJoined = false
	}
}

// GetJustJoined returns value of JustJoined conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// SetVersioned sets value of Versioned conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(5)
		.Versioned = true
	} else {
		.Flags.Unset(5)
		.Versioned = false
	}
}

// GetVersioned returns value of Versioned conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetMin sets value of Min conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(8)
		.Min = true
	} else {
		.Flags.Unset(8)
		.Min = false
	}
}

// GetMin returns value of Min conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(8)
}

// SetMutedByYou sets value of MutedByYou conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(9)
		.MutedByYou = true
	} else {
		.Flags.Unset(9)
		.MutedByYou = false
	}
}

// GetMutedByYou returns value of MutedByYou conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetVolumeByAdmin sets value of VolumeByAdmin conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(10)
		.VolumeByAdmin = true
	} else {
		.Flags.Unset(10)
		.VolumeByAdmin = false
	}
}

// GetVolumeByAdmin returns value of VolumeByAdmin conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetSelf sets value of Self conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(12)
		.Self = true
	} else {
		.Flags.Unset(12)
		.Self = false
	}
}

// GetSelf returns value of Self conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetVideoJoined sets value of VideoJoined conditional field.
func ( *GroupCallParticipant) ( bool) {
	if  {
		.Flags.Set(15)
		.VideoJoined = true
	} else {
		.Flags.Unset(15)
		.VideoJoined = false
	}
}

// GetVideoJoined returns value of VideoJoined conditional field.
func ( *GroupCallParticipant) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(15)
}

// GetPeer returns value of Peer field.
func ( *GroupCallParticipant) () ( PeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetDate returns value of Date field.
func ( *GroupCallParticipant) () ( int) {
	if  == nil {
		return
	}
	return .Date
}

// SetActiveDate sets value of ActiveDate conditional field.
func ( *GroupCallParticipant) ( int) {
	.Flags.Set(3)
	.ActiveDate = 
}

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

// GetSource returns value of Source field.
func ( *GroupCallParticipant) () ( int) {
	if  == nil {
		return
	}
	return .Source
}

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

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

// SetAbout sets value of About conditional field.
func ( *GroupCallParticipant) ( string) {
	.Flags.Set(11)
	.About = 
}

// GetAbout returns value of About conditional field and
// boolean which is true if field was set.
func ( *GroupCallParticipant) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(11) {
		return , false
	}
	return .About, true
}

// SetRaiseHandRating sets value of RaiseHandRating conditional field.
func ( *GroupCallParticipant) ( int64) {
	.Flags.Set(13)
	.RaiseHandRating = 
}

// GetRaiseHandRating returns value of RaiseHandRating conditional field and
// boolean which is true if field was set.
func ( *GroupCallParticipant) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(13) {
		return , false
	}
	return .RaiseHandRating, true
}

// SetVideo sets value of Video conditional field.
func ( *GroupCallParticipant) ( GroupCallParticipantVideo) {
	.Flags.Set(6)
	.Video = 
}

// GetVideo returns value of Video conditional field and
// boolean which is true if field was set.
func ( *GroupCallParticipant) () ( GroupCallParticipantVideo,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(6) {
		return , false
	}
	return .Video, true
}

// SetPresentation sets value of Presentation conditional field.
func ( *GroupCallParticipant) ( GroupCallParticipantVideo) {
	.Flags.Set(14)
	.Presentation = 
}

// GetPresentation returns value of Presentation conditional field and
// boolean which is true if field was set.
func ( *GroupCallParticipant) () ( GroupCallParticipantVideo,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(14) {
		return , false
	}
	return .Presentation, true
}