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

// NewSessionCreated represents TL type `new_session_created#9ec20908`.
type NewSessionCreated struct {
	// FirstMsgID field of NewSessionCreated.
	FirstMsgID int64
	// UniqueID field of NewSessionCreated.
	UniqueID int64
	// ServerSalt field of NewSessionCreated.
	ServerSalt int64
}

// NewSessionCreatedTypeID is TL type id of NewSessionCreated.
const NewSessionCreatedTypeID = 0x9ec20908

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

func ( *NewSessionCreated) () bool {
	if  == nil {
		return true
	}
	if !(.FirstMsgID == 0) {
		return false
	}
	if !(.UniqueID == 0) {
		return false
	}
	if !(.ServerSalt == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *NewSessionCreated) () tdp.Type {
	 := tdp.Type{
		Name: "new_session_created",
		ID:   NewSessionCreatedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FirstMsgID",
			SchemaName: "first_msg_id",
		},
		{
			Name:       "UniqueID",
			SchemaName: "unique_id",
		},
		{
			Name:       "ServerSalt",
			SchemaName: "server_salt",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *NewSessionCreated) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode new_session_created#9ec20908 as nil")
	}
	.PutID(NewSessionCreatedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *NewSessionCreated) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode new_session_created#9ec20908 as nil")
	}
	.PutLong(.FirstMsgID)
	.PutLong(.UniqueID)
	.PutLong(.ServerSalt)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *NewSessionCreated) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode new_session_created#9ec20908 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode new_session_created#9ec20908: field first_msg_id: %w", )
		}
		.FirstMsgID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode new_session_created#9ec20908: field unique_id: %w", )
		}
		.UniqueID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode new_session_created#9ec20908: field server_salt: %w", )
		}
		.ServerSalt = 
	}
	return nil
}

// GetFirstMsgID returns value of FirstMsgID field.
func ( *NewSessionCreated) () ( int64) {
	if  == nil {
		return
	}
	return .FirstMsgID
}

// GetUniqueID returns value of UniqueID field.
func ( *NewSessionCreated) () ( int64) {
	if  == nil {
		return
	}
	return .UniqueID
}

// GetServerSalt returns value of ServerSalt field.
func ( *NewSessionCreated) () ( int64) {
	if  == nil {
		return
	}
	return .ServerSalt
}