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

// ReqDHParamsRequest represents TL type `req_DH_params#d712e4be`.
type ReqDHParamsRequest struct {
	// Nonce field of ReqDHParamsRequest.
	Nonce bin.Int128
	// ServerNonce field of ReqDHParamsRequest.
	ServerNonce bin.Int128
	// P field of ReqDHParamsRequest.
	P []byte
	// Q field of ReqDHParamsRequest.
	Q []byte
	// PublicKeyFingerprint field of ReqDHParamsRequest.
	PublicKeyFingerprint int64
	// EncryptedData field of ReqDHParamsRequest.
	EncryptedData []byte
}

// ReqDHParamsRequestTypeID is TL type id of ReqDHParamsRequest.
const ReqDHParamsRequestTypeID = 0xd712e4be

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

func ( *ReqDHParamsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Nonce == bin.Int128{}) {
		return false
	}
	if !(.ServerNonce == bin.Int128{}) {
		return false
	}
	if !(.P == nil) {
		return false
	}
	if !(.Q == nil) {
		return false
	}
	if !(.PublicKeyFingerprint == 0) {
		return false
	}
	if !(.EncryptedData == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *ReqDHParamsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "req_DH_params",
		ID:   ReqDHParamsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
		{
			Name:       "ServerNonce",
			SchemaName: "server_nonce",
		},
		{
			Name:       "P",
			SchemaName: "p",
		},
		{
			Name:       "Q",
			SchemaName: "q",
		},
		{
			Name:       "PublicKeyFingerprint",
			SchemaName: "public_key_fingerprint",
		},
		{
			Name:       "EncryptedData",
			SchemaName: "encrypted_data",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ReqDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode req_DH_params#d712e4be as nil")
	}
	.PutID(ReqDHParamsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ReqDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode req_DH_params#d712e4be as nil")
	}
	.PutInt128(.Nonce)
	.PutInt128(.ServerNonce)
	.PutBytes(.P)
	.PutBytes(.Q)
	.PutLong(.PublicKeyFingerprint)
	.PutBytes(.EncryptedData)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ReqDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode req_DH_params#d712e4be to nil")
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field nonce: %w", )
		}
		.Nonce = 
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field server_nonce: %w", )
		}
		.ServerNonce = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field p: %w", )
		}
		.P = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field q: %w", )
		}
		.Q = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field public_key_fingerprint: %w", )
		}
		.PublicKeyFingerprint = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode req_DH_params#d712e4be: field encrypted_data: %w", )
		}
		.EncryptedData = 
	}
	return nil
}

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

// GetServerNonce returns value of ServerNonce field.
func ( *ReqDHParamsRequest) () ( bin.Int128) {
	if  == nil {
		return
	}
	return .ServerNonce
}

// GetP returns value of P field.
func ( *ReqDHParamsRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .P
}

// GetQ returns value of Q field.
func ( *ReqDHParamsRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Q
}

// GetPublicKeyFingerprint returns value of PublicKeyFingerprint field.
func ( *ReqDHParamsRequest) () ( int64) {
	if  == nil {
		return
	}
	return .PublicKeyFingerprint
}

// GetEncryptedData returns value of EncryptedData field.
func ( *ReqDHParamsRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .EncryptedData
}