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

// PhoneSendGroupCallMessageRequest represents TL type `phone.sendGroupCallMessage#b1d11410`.
// Send a transient in-call message to all participants of a group call or livestream¹.
//
// Links:
//  1. https://core.telegram.org/api/group-calls#conference-calls
//
// See https://core.telegram.org/method/phone.sendGroupCallMessage for reference.
type PhoneSendGroupCallMessageRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Call field of PhoneSendGroupCallMessageRequest.
	Call InputGroupCallClass
	// RandomID field of PhoneSendGroupCallMessageRequest.
	RandomID int64
	// Message field of PhoneSendGroupCallMessageRequest.
	Message TextWithEntities
	// AllowPaidStars field of PhoneSendGroupCallMessageRequest.
	//
	// Use SetAllowPaidStars and GetAllowPaidStars helpers.
	AllowPaidStars int64
	// SendAs field of PhoneSendGroupCallMessageRequest.
	//
	// Use SetSendAs and GetSendAs helpers.
	SendAs InputPeerClass
}

// PhoneSendGroupCallMessageRequestTypeID is TL type id of PhoneSendGroupCallMessageRequest.
const PhoneSendGroupCallMessageRequestTypeID = 0xb1d11410

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

func ( *PhoneSendGroupCallMessageRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Call == nil) {
		return false
	}
	if !(.RandomID == 0) {
		return false
	}
	if !(.Message.Zero()) {
		return false
	}
	if !(.AllowPaidStars == 0) {
		return false
	}
	if !(.SendAs == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneSendGroupCallMessageRequest from given interface.
func ( *PhoneSendGroupCallMessageRequest) ( interface {
	() ( InputGroupCallClass)
	() ( int64)
	() ( TextWithEntities)
	() ( int64,  bool)
	() ( InputPeerClass,  bool)
}) {
	.Call = .()
	.RandomID = .()
	.Message = .()
	if ,  := .();  {
		.AllowPaidStars = 
	}

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

}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneSendGroupCallMessageRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.sendGroupCallMessage",
		ID:   PhoneSendGroupCallMessageRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "RandomID",
			SchemaName: "random_id",
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "AllowPaidStars",
			SchemaName: "allow_paid_stars",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "SendAs",
			SchemaName: "send_as",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PhoneSendGroupCallMessageRequest) () {
	if !(.AllowPaidStars == 0) {
		.Flags.Set(0)
	}
	if !(.SendAs == nil) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *PhoneSendGroupCallMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.sendGroupCallMessage#b1d11410 as nil")
	}
	.PutID(PhoneSendGroupCallMessageRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneSendGroupCallMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.sendGroupCallMessage#b1d11410 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field flags: %w", )
	}
	if .Call == nil {
		return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field call is nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field call: %w", )
	}
	.PutLong(.RandomID)
	if  := .Message.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field message: %w", )
	}
	if .Flags.Has(0) {
		.PutLong(.AllowPaidStars)
	}
	if .Flags.Has(1) {
		if .SendAs == nil {
			return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field send_as is nil")
		}
		if  := .SendAs.Encode();  != nil {
			return fmt.Errorf("unable to encode phone.sendGroupCallMessage#b1d11410: field send_as: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneSendGroupCallMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.sendGroupCallMessage#b1d11410 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field flags: %w", )
		}
	}
	{
		,  := DecodeInputGroupCall()
		if  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field call: %w", )
		}
		.Call = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field random_id: %w", )
		}
		.RandomID = 
	}
	{
		if  := .Message.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field message: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field allow_paid_stars: %w", )
		}
		.AllowPaidStars = 
	}
	if .Flags.Has(1) {
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode phone.sendGroupCallMessage#b1d11410: field send_as: %w", )
		}
		.SendAs = 
	}
	return nil
}

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

// GetRandomID returns value of RandomID field.
func ( *PhoneSendGroupCallMessageRequest) () ( int64) {
	if  == nil {
		return
	}
	return .RandomID
}

// GetMessage returns value of Message field.
func ( *PhoneSendGroupCallMessageRequest) () ( TextWithEntities) {
	if  == nil {
		return
	}
	return .Message
}

// SetAllowPaidStars sets value of AllowPaidStars conditional field.
func ( *PhoneSendGroupCallMessageRequest) ( int64) {
	.Flags.Set(0)
	.AllowPaidStars = 
}

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

// SetSendAs sets value of SendAs conditional field.
func ( *PhoneSendGroupCallMessageRequest) ( InputPeerClass) {
	.Flags.Set(1)
	.SendAs = 
}

// GetSendAs returns value of SendAs conditional field and
// boolean which is true if field was set.
func ( *PhoneSendGroupCallMessageRequest) () ( InputPeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .SendAs, true
}

// PhoneSendGroupCallMessage invokes method phone.sendGroupCallMessage#b1d11410 returning error if any.
// Send a transient in-call message to all participants of a group call or livestream¹.
//
// 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.sendGroupCallMessage for reference.
func ( *Client) ( context.Context,  *PhoneSendGroupCallMessageRequest) (UpdatesClass, error) {
	var  UpdatesBox

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