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

// PhoneLeaveGroupCallRequest represents TL type `phone.leaveGroupCall#500377f9`.
// Leave a group call
//
// See https://core.telegram.org/method/phone.leaveGroupCall for reference.
type PhoneLeaveGroupCallRequest struct {
	// The group call
	Call InputGroupCall
	// Your source ID
	Source int
}

// PhoneLeaveGroupCallRequestTypeID is TL type id of PhoneLeaveGroupCallRequest.
const PhoneLeaveGroupCallRequestTypeID = 0x500377f9

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

func ( *PhoneLeaveGroupCallRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Call.Zero()) {
		return false
	}
	if !(.Source == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneLeaveGroupCallRequest from given interface.
func ( *PhoneLeaveGroupCallRequest) ( interface {
	() ( InputGroupCall)
	() ( int)
}) {
	.Call = .()
	.Source = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneLeaveGroupCallRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.leaveGroupCall",
		ID:   PhoneLeaveGroupCallRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Source",
			SchemaName: "source",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneLeaveGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.leaveGroupCall#500377f9 as nil")
	}
	.PutID(PhoneLeaveGroupCallRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneLeaveGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.leaveGroupCall#500377f9 as nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.leaveGroupCall#500377f9: field call: %w", )
	}
	.PutInt(.Source)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneLeaveGroupCallRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.leaveGroupCall#500377f9 to nil")
	}
	{
		if  := .Call.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.leaveGroupCall#500377f9: field call: %w", )
		}
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode phone.leaveGroupCall#500377f9: field source: %w", )
		}
		.Source = 
	}
	return nil
}

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

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

// PhoneLeaveGroupCall invokes method phone.leaveGroupCall#500377f9 returning error if any.
// Leave a group call
//
// See https://core.telegram.org/method/phone.leaveGroupCall for reference.
func ( *Client) ( context.Context,  *PhoneLeaveGroupCallRequest) (UpdatesClass, error) {
	var  UpdatesBox

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