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

// ReqPqRequest represents TL type `req_pq#60469778`.
type ReqPqRequest struct {
	// Nonce field of ReqPqRequest.
	Nonce bin.Int128
}

// ReqPqRequestTypeID is TL type id of ReqPqRequest.
const ReqPqRequestTypeID = 0x60469778

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

func ( *ReqPqRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Nonce == bin.Int128{}) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *ReqPqRequest) () tdp.Type {
	 := tdp.Type{
		Name: "req_pq",
		ID:   ReqPqRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ReqPqRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode req_pq#60469778 as nil")
	}
	.PutID(ReqPqRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ReqPqRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode req_pq#60469778 as nil")
	}
	.PutInt128(.Nonce)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ReqPqRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode req_pq#60469778 to nil")
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode req_pq#60469778: field nonce: %w", )
		}
		.Nonce = 
	}
	return nil
}

// GetNonce returns value of Nonce field.
func ( *ReqPqRequest) () ( bin.Int128) {
	if  == nil {
		return
	}
	return .Nonce
}