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

// PhoneExportGroupCallInviteRequest represents TL type `phone.exportGroupCallInvite#e6aa647f`.
// Get an invite link¹ for a group call or livestream
//
// Links:
//  1. https://core.telegram.org/api/links#video-chat-livestream-links
//
// See https://core.telegram.org/method/phone.exportGroupCallInvite for reference.
type PhoneExportGroupCallInviteRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// For livestreams or muted group chats, if set, users that join using this link will be
	// able to speak without explicitly requesting permission by (for example by raising
	// their hand).
	CanSelfUnmute bool
	// The group call
	Call InputGroupCall
}

// PhoneExportGroupCallInviteRequestTypeID is TL type id of PhoneExportGroupCallInviteRequest.
const PhoneExportGroupCallInviteRequestTypeID = 0xe6aa647f

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

func ( *PhoneExportGroupCallInviteRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.CanSelfUnmute == false) {
		return false
	}
	if !(.Call.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneExportGroupCallInviteRequest from given interface.
func ( *PhoneExportGroupCallInviteRequest) ( interface {
	() ( bool)
	() ( InputGroupCall)
}) {
	.CanSelfUnmute = .()
	.Call = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneExportGroupCallInviteRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.exportGroupCallInvite",
		ID:   PhoneExportGroupCallInviteRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "CanSelfUnmute",
			SchemaName: "can_self_unmute",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Call",
			SchemaName: "call",
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *PhoneExportGroupCallInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.exportGroupCallInvite#e6aa647f as nil")
	}
	.PutID(PhoneExportGroupCallInviteRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneExportGroupCallInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.exportGroupCallInvite#e6aa647f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.exportGroupCallInvite#e6aa647f: field flags: %w", )
		}
	}
	.CanSelfUnmute = .Flags.Has(0)
	{
		if  := .Call.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.exportGroupCallInvite#e6aa647f: field call: %w", )
		}
	}
	return nil
}

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

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

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

// PhoneExportGroupCallInvite invokes method phone.exportGroupCallInvite#e6aa647f returning error if any.
// Get an invite link¹ for a group call or livestream
//
// Links:
//  1. https://core.telegram.org/api/links#video-chat-livestream-links
//
// Possible errors:
//
//	403 PUBLIC_CHANNEL_MISSING: You can only export group call invite links for public chats or channels.
//
// See https://core.telegram.org/method/phone.exportGroupCallInvite for reference.
func ( *Client) ( context.Context,  *PhoneExportGroupCallInviteRequest) (*PhoneExportedGroupCallInvite, error) {
	var  PhoneExportedGroupCallInvite

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