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

// ServerDHInnerData represents TL type `server_DH_inner_data#b5890dba`.
type ServerDHInnerData struct {
	// Nonce field of ServerDHInnerData.
	Nonce bin.Int128
	// ServerNonce field of ServerDHInnerData.
	ServerNonce bin.Int128
	// G field of ServerDHInnerData.
	G int
	// DhPrime field of ServerDHInnerData.
	DhPrime []byte
	// GA field of ServerDHInnerData.
	GA []byte
	// ServerTime field of ServerDHInnerData.
	ServerTime int
}

// ServerDHInnerDataTypeID is TL type id of ServerDHInnerData.
const ServerDHInnerDataTypeID = 0xb5890dba

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

func ( *ServerDHInnerData) () bool {
	if  == nil {
		return true
	}
	if !(.Nonce == bin.Int128{}) {
		return false
	}
	if !(.ServerNonce == bin.Int128{}) {
		return false
	}
	if !(.G == 0) {
		return false
	}
	if !(.DhPrime == nil) {
		return false
	}
	if !(.GA == nil) {
		return false
	}
	if !(.ServerTime == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *ServerDHInnerData) () tdp.Type {
	 := tdp.Type{
		Name: "server_DH_inner_data",
		ID:   ServerDHInnerDataTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
		{
			Name:       "ServerNonce",
			SchemaName: "server_nonce",
		},
		{
			Name:       "G",
			SchemaName: "g",
		},
		{
			Name:       "DhPrime",
			SchemaName: "dh_prime",
		},
		{
			Name:       "GA",
			SchemaName: "g_a",
		},
		{
			Name:       "ServerTime",
			SchemaName: "server_time",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ServerDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode server_DH_inner_data#b5890dba as nil")
	}
	.PutID(ServerDHInnerDataTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ServerDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode server_DH_inner_data#b5890dba as nil")
	}
	.PutInt128(.Nonce)
	.PutInt128(.ServerNonce)
	.PutInt(.G)
	.PutBytes(.DhPrime)
	.PutBytes(.GA)
	.PutInt(.ServerTime)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ServerDHInnerData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode server_DH_inner_data#b5890dba to nil")
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field nonce: %w", )
		}
		.Nonce = 
	}
	{
		,  := .Int128()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field server_nonce: %w", )
		}
		.ServerNonce = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field g: %w", )
		}
		.G = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field dh_prime: %w", )
		}
		.DhPrime = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field g_a: %w", )
		}
		.GA = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field server_time: %w", )
		}
		.ServerTime = 
	}
	return nil
}

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

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

// GetG returns value of G field.
func ( *ServerDHInnerData) () ( int) {
	if  == nil {
		return
	}
	return .G
}

// GetDhPrime returns value of DhPrime field.
func ( *ServerDHInnerData) () ( []byte) {
	if  == nil {
		return
	}
	return .DhPrime
}

// GetGA returns value of GA field.
func ( *ServerDHInnerData) () ( []byte) {
	if  == nil {
		return
	}
	return .GA
}

// GetServerTime returns value of ServerTime field.
func ( *ServerDHInnerData) () ( int) {
	if  == nil {
		return
	}
	return .ServerTime
}