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

// ClientDHInnerData represents TL type `client_DH_inner_data#6643b654`.
type ClientDHInnerData struct {
	// Nonce field of ClientDHInnerData.
	Nonce bin.Int128
	// ServerNonce field of ClientDHInnerData.
	ServerNonce bin.Int128
	// RetryID field of ClientDHInnerData.
	RetryID int64
	// GB field of ClientDHInnerData.
	GB []byte
}

// ClientDHInnerDataTypeID is TL type id of ClientDHInnerData.
const ClientDHInnerDataTypeID = 0x6643b654

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

func ( *ClientDHInnerData) () bool {
	if  == nil {
		return true
	}
	if !(.Nonce == bin.Int128{}) {
		return false
	}
	if !(.ServerNonce == bin.Int128{}) {
		return false
	}
	if !(.RetryID == 0) {
		return false
	}
	if !(.GB == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *ClientDHInnerData) () tdp.Type {
	 := tdp.Type{
		Name: "client_DH_inner_data",
		ID:   ClientDHInnerDataTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
		{
			Name:       "ServerNonce",
			SchemaName: "server_nonce",
		},
		{
			Name:       "RetryID",
			SchemaName: "retry_id",
		},
		{
			Name:       "GB",
			SchemaName: "g_b",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ClientDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode client_DH_inner_data#6643b654 as nil")
	}
	.PutID(ClientDHInnerDataTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ClientDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode client_DH_inner_data#6643b654 as nil")
	}
	.PutInt128(.Nonce)
	.PutInt128(.ServerNonce)
	.PutLong(.RetryID)
	.PutBytes(.GB)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ClientDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode client_DH_inner_data#6643b654 to nil")
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field nonce: %w", )
		}
		.Nonce = 
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field server_nonce: %w", )
		}
		.ServerNonce = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field retry_id: %w", )
		}
		.RetryID = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field g_b: %w", )
		}
		.GB = 
	}
	return nil
}

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

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

// GetRetryID returns value of RetryID field.
func ( *ClientDHInnerData) () ( int64) {
	if  == nil {
		return
	}
	return .RetryID
}

// GetGB returns value of GB field.
func ( *ClientDHInnerData) () ( []byte) {
	if  == nil {
		return
	}
	return .GB
}