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

// PhoneSaveCallLogRequest represents TL type `phone.saveCallLog#41248786`.
// Save phone call debug information
//
// See https://core.telegram.org/method/phone.saveCallLog for reference.
type PhoneSaveCallLogRequest struct {
	// Phone call
	Peer InputPhoneCall
	// Logs
	File InputFileClass
}

// PhoneSaveCallLogRequestTypeID is TL type id of PhoneSaveCallLogRequest.
const PhoneSaveCallLogRequestTypeID = 0x41248786

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

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

	return true
}

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

// FillFrom fills PhoneSaveCallLogRequest from given interface.
func ( *PhoneSaveCallLogRequest) ( interface {
	() ( InputPhoneCall)
	() ( InputFileClass)
}) {
	.Peer = .()
	.File = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneSaveCallLogRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.saveCallLog",
		ID:   PhoneSaveCallLogRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "File",
			SchemaName: "file",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneSaveCallLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.saveCallLog#41248786 as nil")
	}
	.PutID(PhoneSaveCallLogRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneSaveCallLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.saveCallLog#41248786 to nil")
	}
	{
		if  := .Peer.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.saveCallLog#41248786: field peer: %w", )
		}
	}
	{
		,  := DecodeInputFile()
		if  != nil {
			return fmt.Errorf("unable to decode phone.saveCallLog#41248786: field file: %w", )
		}
		.File = 
	}
	return nil
}

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

// GetFile returns value of File field.
func ( *PhoneSaveCallLogRequest) () ( InputFileClass) {
	if  == nil {
		return
	}
	return .File
}

// PhoneSaveCallLog invokes method phone.saveCallLog#41248786 returning error if any.
// Save phone call debug information
//
// See https://core.telegram.org/method/phone.saveCallLog for reference.
func ( *Client) ( context.Context,  *PhoneSaveCallLogRequest) (bool, error) {
	var  BoolBox

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