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

// SetClientDHParamsRequest represents TL type `set_client_DH_params#f5045f1f`.
type SetClientDHParamsRequest struct {
	// Nonce field of SetClientDHParamsRequest.
	Nonce bin.Int128
	// ServerNonce field of SetClientDHParamsRequest.
	ServerNonce bin.Int128
	// EncryptedData field of SetClientDHParamsRequest.
	EncryptedData []byte
}

// SetClientDHParamsRequestTypeID is TL type id of SetClientDHParamsRequest.
const SetClientDHParamsRequestTypeID = 0xf5045f1f

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

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

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *SetClientDHParamsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "set_client_DH_params",
		ID:   SetClientDHParamsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
		{
			Name:       "ServerNonce",
			SchemaName: "server_nonce",
		},
		{
			Name:       "EncryptedData",
			SchemaName: "encrypted_data",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SetClientDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode set_client_DH_params#f5045f1f as nil")
	}
	.PutID(SetClientDHParamsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SetClientDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode set_client_DH_params#f5045f1f as nil")
	}
	.PutInt128(.Nonce)
	.PutInt128(.ServerNonce)
	.PutBytes(.EncryptedData)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *SetClientDHParamsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode set_client_DH_params#f5045f1f to nil")
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field nonce: %w", )
		}
		.Nonce = 
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field server_nonce: %w", )
		}
		.ServerNonce = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field encrypted_data: %w", )
		}
		.EncryptedData = 
	}
	return nil
}

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

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

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