// Code generated by gotdgen, DO NOT EDIT.

package mt

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

// RPCResult represents TL type `rpc_result#f35c6d01`.
type RPCResult struct {
	// ReqMsgID field of RPCResult.
	ReqMsgID int64
	// Result field of RPCResult.
	Result GzipPacked
}

// RPCResultTypeID is TL type id of RPCResult.
const RPCResultTypeID = 0xf35c6d01

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

func ( *RPCResult) () bool {
	if  == nil {
		return true
	}
	if !(.ReqMsgID == 0) {
		return false
	}
	if !(.Result.Zero()) {
		return false
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*RPCResult) () string {
	return "rpc_result"
}

// TypeInfo returns info about TL type.
func ( *RPCResult) () tdp.Type {
	 := tdp.Type{
		Name: "rpc_result",
		ID:   RPCResultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ReqMsgID",
			SchemaName: "req_msg_id",
		},
		{
			Name:       "Result",
			SchemaName: "result",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *RPCResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode rpc_result#f35c6d01 as nil")
	}
	.PutID(RPCResultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *RPCResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode rpc_result#f35c6d01 as nil")
	}
	.PutLong(.ReqMsgID)
	if  := .Result.Encode();  != nil {
		return fmt.Errorf("unable to encode rpc_result#f35c6d01: field result: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *RPCResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode rpc_result#f35c6d01 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode rpc_result#f35c6d01: field req_msg_id: %w", )
		}
		.ReqMsgID = 
	}
	{
		if  := .Result.Decode();  != nil {
			return fmt.Errorf("unable to decode rpc_result#f35c6d01: field result: %w", )
		}
	}
	return nil
}

// GetReqMsgID returns value of ReqMsgID field.
func ( *RPCResult) () ( int64) {
	if  == nil {
		return
	}
	return .ReqMsgID
}

// GetResult returns value of Result field.
func ( *RPCResult) () ( GzipPacked) {
	if  == nil {
		return
	}
	return .Result
}