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

// PhoneSaveCallDebugRequest represents TL type `phone.saveCallDebug#277add7e`.
// Send phone call debug data to server
//
// See https://core.telegram.org/method/phone.saveCallDebug for reference.
type PhoneSaveCallDebugRequest struct {
	// Phone call
	Peer InputPhoneCall
	// Debug statistics obtained from libtgvoip
	Debug DataJSON
}

// PhoneSaveCallDebugRequestTypeID is TL type id of PhoneSaveCallDebugRequest.
const PhoneSaveCallDebugRequestTypeID = 0x277add7e

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

func ( *PhoneSaveCallDebugRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer.Zero()) {
		return false
	}
	if !(.Debug.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneSaveCallDebugRequest from given interface.
func ( *PhoneSaveCallDebugRequest) ( interface {
	() ( InputPhoneCall)
	() ( DataJSON)
}) {
	.Peer = .()
	.Debug = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneSaveCallDebugRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.saveCallDebug",
		ID:   PhoneSaveCallDebugRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Debug",
			SchemaName: "debug",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneSaveCallDebugRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.saveCallDebug#277add7e as nil")
	}
	.PutID(PhoneSaveCallDebugRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneSaveCallDebugRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.saveCallDebug#277add7e as nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.saveCallDebug#277add7e: field peer: %w", )
	}
	if  := .Debug.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.saveCallDebug#277add7e: field debug: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneSaveCallDebugRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.saveCallDebug#277add7e to nil")
	}
	{
		if  := .Peer.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.saveCallDebug#277add7e: field peer: %w", )
		}
	}
	{
		if  := .Debug.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.saveCallDebug#277add7e: field debug: %w", )
		}
	}
	return nil
}

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

// GetDebug returns value of Debug field.
func ( *PhoneSaveCallDebugRequest) () ( DataJSON) {
	if  == nil {
		return
	}
	return .Debug
}

// PhoneSaveCallDebug invokes method phone.saveCallDebug#277add7e returning error if any.
// Send phone call debug data to server
//
// Possible errors:
//
//	400 CALL_PEER_INVALID: The provided call peer object is invalid.
//	400 DATA_JSON_INVALID: The provided JSON data is invalid.
//
// See https://core.telegram.org/method/phone.saveCallDebug for reference.
func ( *Client) ( context.Context,  *PhoneSaveCallDebugRequest) (bool, error) {
	var  BoolBox

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