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

// WalletNftAttribute represents TL type `wallet.nftAttribute#4c1ef10e`.
//
// See https://core.telegram.org/constructor/wallet.nftAttribute for reference.
type WalletNftAttribute struct {
	// TraitType field of WalletNftAttribute.
	TraitType string
	// Value field of WalletNftAttribute.
	Value string
}

// WalletNftAttributeTypeID is TL type id of WalletNftAttribute.
const WalletNftAttributeTypeID = 0x4c1ef10e

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

func ( *WalletNftAttribute) () bool {
	if  == nil {
		return true
	}
	if !(.TraitType == "") {
		return false
	}
	if !(.Value == "") {
		return false
	}

	return true
}

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

// FillFrom fills WalletNftAttribute from given interface.
func ( *WalletNftAttribute) ( interface {
	() ( string)
	() ( string)
}) {
	.TraitType = .()
	.Value = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *WalletNftAttribute) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.nftAttribute",
		ID:   WalletNftAttributeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "TraitType",
			SchemaName: "trait_type",
		},
		{
			Name:       "Value",
			SchemaName: "value",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *WalletNftAttribute) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.nftAttribute#4c1ef10e as nil")
	}
	.PutID(WalletNftAttributeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletNftAttribute) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.nftAttribute#4c1ef10e as nil")
	}
	.PutString(.TraitType)
	.PutString(.Value)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WalletNftAttribute) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.nftAttribute#4c1ef10e to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.nftAttribute#4c1ef10e: field trait_type: %w", )
		}
		.TraitType = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.nftAttribute#4c1ef10e: field value: %w", )
		}
		.Value = 
	}
	return nil
}

// GetTraitType returns value of TraitType field.
func ( *WalletNftAttribute) () ( string) {
	if  == nil {
		return
	}
	return .TraitType
}

// GetValue returns value of Value field.
func ( *WalletNftAttribute) () ( string) {
	if  == nil {
		return
	}
	return .Value
}