// Code generated by gotdgen, DO NOT EDIT.

package tg

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

// WalletSecretPhraseParts represents TL type `wallet.secretPhraseParts#e6d0ef01`.
//
// See https://core.telegram.org/constructor/wallet.secretPhraseParts for reference.
type WalletSecretPhraseParts struct {
	// Token field of WalletSecretPhraseParts.
	Token string
	// DCs field of WalletSecretPhraseParts.
	DCs []int
}

// WalletSecretPhrasePartsTypeID is TL type id of WalletSecretPhraseParts.
const WalletSecretPhrasePartsTypeID = 0xe6d0ef01

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

func ( *WalletSecretPhraseParts) () bool {
	if  == nil {
		return true
	}
	if !(.Token == "") {
		return false
	}
	if !(.DCs == nil) {
		return false
	}

	return true
}

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

// FillFrom fills WalletSecretPhraseParts from given interface.
func ( *WalletSecretPhraseParts) ( interface {
	() ( string)
	() ( []int)
}) {
	.Token = .()
	.DCs = .()
}

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

// TypeName returns name of type in TL schema.
func (*WalletSecretPhraseParts) () string {
	return "wallet.secretPhraseParts"
}

// TypeInfo returns info about TL type.
func ( *WalletSecretPhraseParts) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.secretPhraseParts",
		ID:   WalletSecretPhrasePartsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Token",
			SchemaName: "token",
		},
		{
			Name:       "DCs",
			SchemaName: "dcs",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *WalletSecretPhraseParts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.secretPhraseParts#e6d0ef01 as nil")
	}
	.PutID(WalletSecretPhrasePartsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletSecretPhraseParts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.secretPhraseParts#e6d0ef01 as nil")
	}
	.PutString(.Token)
	.PutVectorHeader(len(.DCs))
	for ,  := range .DCs {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WalletSecretPhraseParts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.secretPhraseParts#e6d0ef01 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.secretPhraseParts#e6d0ef01: field token: %w", )
		}
		.Token = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.secretPhraseParts#e6d0ef01: field dcs: %w", )
		}

		if  > 0 {
			.DCs = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode wallet.secretPhraseParts#e6d0ef01: field dcs: %w", )
			}
			.DCs = append(.DCs, )
		}
	}
	return nil
}

// GetToken returns value of Token field.
func ( *WalletSecretPhraseParts) () ( string) {
	if  == nil {
		return
	}
	return .Token
}

// GetDCs returns value of DCs field.
func ( *WalletSecretPhraseParts) () ( []int) {
	if  == nil {
		return
	}
	return .DCs
}