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

// FragmentCollectibleInfo represents TL type `fragment.collectibleInfo#6ebdff91`.
// Info about a fragment collectible¹.
//
// Links:
//  1. https://core.telegram.org/api/fragment
//
// See https://core.telegram.org/constructor/fragment.collectibleInfo for reference.
type FragmentCollectibleInfo struct {
	// Purchase date (unixtime)
	PurchaseDate int
	// Three-letter ISO 4217 currency¹ code for amount
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Total price in the smallest units of the currency (integer, not float/double). For
	// example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
	// currencies.json¹, it shows the number of digits past the decimal point for each
	// currency (2 for the majority of currencies).
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments/currencies.json
	Amount int64
	// Cryptocurrency name.
	CryptoCurrency string
	// Price, in the smallest units of the cryptocurrency.
	CryptoAmount int64
	// Fragment¹ URL with more info about the collectible
	//
	// Links:
	//  1) https://fragment.com
	URL string
}

// FragmentCollectibleInfoTypeID is TL type id of FragmentCollectibleInfo.
const FragmentCollectibleInfoTypeID = 0x6ebdff91

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

func ( *FragmentCollectibleInfo) () bool {
	if  == nil {
		return true
	}
	if !(.PurchaseDate == 0) {
		return false
	}
	if !(.Currency == "") {
		return false
	}
	if !(.Amount == 0) {
		return false
	}
	if !(.CryptoCurrency == "") {
		return false
	}
	if !(.CryptoAmount == 0) {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills FragmentCollectibleInfo from given interface.
func ( *FragmentCollectibleInfo) ( interface {
	() ( int)
	() ( string)
	() ( int64)
	() ( string)
	() ( int64)
	() ( string)
}) {
	.PurchaseDate = .()
	.Currency = .()
	.Amount = .()
	.CryptoCurrency = .()
	.CryptoAmount = .()
	.URL = .()
}

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

// TypeName returns name of type in TL schema.
func (*FragmentCollectibleInfo) () string {
	return "fragment.collectibleInfo"
}

// TypeInfo returns info about TL type.
func ( *FragmentCollectibleInfo) () tdp.Type {
	 := tdp.Type{
		Name: "fragment.collectibleInfo",
		ID:   FragmentCollectibleInfoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PurchaseDate",
			SchemaName: "purchase_date",
		},
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "Amount",
			SchemaName: "amount",
		},
		{
			Name:       "CryptoCurrency",
			SchemaName: "crypto_currency",
		},
		{
			Name:       "CryptoAmount",
			SchemaName: "crypto_amount",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *FragmentCollectibleInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode fragment.collectibleInfo#6ebdff91 as nil")
	}
	.PutID(FragmentCollectibleInfoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *FragmentCollectibleInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode fragment.collectibleInfo#6ebdff91 as nil")
	}
	.PutInt(.PurchaseDate)
	.PutString(.Currency)
	.PutLong(.Amount)
	.PutString(.CryptoCurrency)
	.PutLong(.CryptoAmount)
	.PutString(.URL)
	return nil
}

// Decode implements bin.Decoder.
func ( *FragmentCollectibleInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode fragment.collectibleInfo#6ebdff91 to nil")
	}
	if  := .ConsumeID(FragmentCollectibleInfoTypeID);  != nil {
		return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *FragmentCollectibleInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode fragment.collectibleInfo#6ebdff91 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field purchase_date: %w", )
		}
		.PurchaseDate = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field currency: %w", )
		}
		.Currency = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field amount: %w", )
		}
		.Amount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field crypto_currency: %w", )
		}
		.CryptoCurrency = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field crypto_amount: %w", )
		}
		.CryptoAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.collectibleInfo#6ebdff91: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetPurchaseDate returns value of PurchaseDate field.
func ( *FragmentCollectibleInfo) () ( int) {
	if  == nil {
		return
	}
	return .PurchaseDate
}

// GetCurrency returns value of Currency field.
func ( *FragmentCollectibleInfo) () ( string) {
	if  == nil {
		return
	}
	return .Currency
}

// GetAmount returns value of Amount field.
func ( *FragmentCollectibleInfo) () ( int64) {
	if  == nil {
		return
	}
	return .Amount
}

// GetCryptoCurrency returns value of CryptoCurrency field.
func ( *FragmentCollectibleInfo) () ( string) {
	if  == nil {
		return
	}
	return .CryptoCurrency
}

// GetCryptoAmount returns value of CryptoAmount field.
func ( *FragmentCollectibleInfo) () ( int64) {
	if  == nil {
		return
	}
	return .CryptoAmount
}

// GetURL returns value of URL field.
func ( *FragmentCollectibleInfo) () ( string) {
	if  == nil {
		return
	}
	return .URL
}