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

// FutureSalts represents TL type `future_salts#ae500895`.
type FutureSalts struct {
	// ReqMsgID field of FutureSalts.
	ReqMsgID int64
	// Now field of FutureSalts.
	Now int
	// Salts field of FutureSalts.
	Salts []FutureSalt
}

// FutureSaltsTypeID is TL type id of FutureSalts.
const FutureSaltsTypeID = 0xae500895

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

func ( *FutureSalts) () bool {
	if  == nil {
		return true
	}
	if !(.ReqMsgID == 0) {
		return false
	}
	if !(.Now == 0) {
		return false
	}
	if !(.Salts == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *FutureSalts) () tdp.Type {
	 := tdp.Type{
		Name: "future_salts",
		ID:   FutureSaltsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ReqMsgID",
			SchemaName: "req_msg_id",
		},
		{
			Name:       "Now",
			SchemaName: "now",
		},
		{
			Name:       "Salts",
			SchemaName: "salts",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *FutureSalts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode future_salts#ae500895 as nil")
	}
	.PutID(FutureSaltsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *FutureSalts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode future_salts#ae500895 as nil")
	}
	.PutLong(.ReqMsgID)
	.PutInt(.Now)
	.PutInt(len(.Salts))
	for ,  := range .Salts {
		if  := .EncodeBare();  != nil {
			return fmt.Errorf("unable to encode bare future_salts#ae500895: field salts element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *FutureSalts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode future_salts#ae500895 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode future_salts#ae500895: field req_msg_id: %w", )
		}
		.ReqMsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode future_salts#ae500895: field now: %w", )
		}
		.Now = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode future_salts#ae500895: field salts: %w", )
		}

		if  > 0 {
			.Salts = make([]FutureSalt, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  FutureSalt
			if  := .DecodeBare();  != nil {
				return fmt.Errorf("unable to decode bare future_salts#ae500895: field salts: %w", )
			}
			.Salts = append(.Salts, )
		}
	}
	return nil
}

// GetReqMsgID returns value of ReqMsgID field.
func ( *FutureSalts) () ( int64) {
	if  == nil {
		return
	}
	return .ReqMsgID
}

// GetNow returns value of Now field.
func ( *FutureSalts) () ( int) {
	if  == nil {
		return
	}
	return .Now
}

// GetSalts returns value of Salts field.
func ( *FutureSalts) () ( []FutureSalt) {
	if  == nil {
		return
	}
	return .Salts
}