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

// PhoneGetGroupCallStreamRtmpURLRequest represents TL type `phone.getGroupCallStreamRtmpUrl#deb3abbf`.
// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the
// actual RTMP livestream with phone.createGroupCall¹ (the rtmp_stream flag must be set).
//
// Links:
//  1. https://core.telegram.org/method/phone.createGroupCall
//
// See https://core.telegram.org/method/phone.getGroupCallStreamRtmpUrl for reference.
type PhoneGetGroupCallStreamRtmpURLRequest struct {
	// Peer to livestream into
	Peer InputPeerClass
	// Whether to revoke the previous stream key or simply return the existing one
	Revoke bool
}

// PhoneGetGroupCallStreamRtmpURLRequestTypeID is TL type id of PhoneGetGroupCallStreamRtmpURLRequest.
const PhoneGetGroupCallStreamRtmpURLRequestTypeID = 0xdeb3abbf

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

func ( *PhoneGetGroupCallStreamRtmpURLRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Revoke == false) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneGetGroupCallStreamRtmpURLRequest from given interface.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) ( interface {
	() ( InputPeerClass)
	() ( bool)
}) {
	.Peer = .()
	.Revoke = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.getGroupCallStreamRtmpUrl",
		ID:   PhoneGetGroupCallStreamRtmpURLRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Revoke",
			SchemaName: "revoke",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.getGroupCallStreamRtmpUrl#deb3abbf as nil")
	}
	.PutID(PhoneGetGroupCallStreamRtmpURLRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.getGroupCallStreamRtmpUrl#deb3abbf as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode phone.getGroupCallStreamRtmpUrl#deb3abbf: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.getGroupCallStreamRtmpUrl#deb3abbf: field peer: %w", )
	}
	.PutBool(.Revoke)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.getGroupCallStreamRtmpUrl#deb3abbf to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode phone.getGroupCallStreamRtmpUrl#deb3abbf: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.getGroupCallStreamRtmpUrl#deb3abbf: field revoke: %w", )
		}
		.Revoke = 
	}
	return nil
}

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

// GetRevoke returns value of Revoke field.
func ( *PhoneGetGroupCallStreamRtmpURLRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Revoke
}

// PhoneGetGroupCallStreamRtmpURL invokes method phone.getGroupCallStreamRtmpUrl#deb3abbf returning error if any.
// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the
// actual RTMP livestream with phone.createGroupCall¹ (the rtmp_stream flag must be set).
//
// Links:
//  1. https://core.telegram.org/method/phone.createGroupCall
//
// Possible errors:
//
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//
// See https://core.telegram.org/method/phone.getGroupCallStreamRtmpUrl for reference.
func ( *Client) ( context.Context,  *PhoneGetGroupCallStreamRtmpURLRequest) (*PhoneGroupCallStreamRtmpURL, error) {
	var  PhoneGroupCallStreamRtmpURL

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