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

// OnrampQuote represents TL type `onrampQuote#7a8011e9`.
//
// See https://core.telegram.org/constructor/onrampQuote for reference.
type OnrampQuote struct {
	// BaseCurrency field of OnrampQuote.
	BaseCurrency string
	// BaseAmount field of OnrampQuote.
	BaseAmount string
	// CryptoCurrency field of OnrampQuote.
	CryptoCurrency string
	// CryptoAmount field of OnrampQuote.
	CryptoAmount string
	// CryptoPrice field of OnrampQuote.
	CryptoPrice string
	// FeeAmount field of OnrampQuote.
	FeeAmount string
	// ExtraFeeAmount field of OnrampQuote.
	ExtraFeeAmount string
	// NetworkFeeAmount field of OnrampQuote.
	NetworkFeeAmount string
	// TotalAmount field of OnrampQuote.
	TotalAmount string
	// PaymentMethod field of OnrampQuote.
	PaymentMethod string
	// ExpiresDate field of OnrampQuote.
	ExpiresDate int
}

// OnrampQuoteTypeID is TL type id of OnrampQuote.
const OnrampQuoteTypeID = 0x7a8011e9

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

func ( *OnrampQuote) () bool {
	if  == nil {
		return true
	}
	if !(.BaseCurrency == "") {
		return false
	}
	if !(.BaseAmount == "") {
		return false
	}
	if !(.CryptoCurrency == "") {
		return false
	}
	if !(.CryptoAmount == "") {
		return false
	}
	if !(.CryptoPrice == "") {
		return false
	}
	if !(.FeeAmount == "") {
		return false
	}
	if !(.ExtraFeeAmount == "") {
		return false
	}
	if !(.NetworkFeeAmount == "") {
		return false
	}
	if !(.TotalAmount == "") {
		return false
	}
	if !(.PaymentMethod == "") {
		return false
	}
	if !(.ExpiresDate == 0) {
		return false
	}

	return true
}

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

// FillFrom fills OnrampQuote from given interface.
func ( *OnrampQuote) ( interface {
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( int)
}) {
	.BaseCurrency = .()
	.BaseAmount = .()
	.CryptoCurrency = .()
	.CryptoAmount = .()
	.CryptoPrice = .()
	.FeeAmount = .()
	.ExtraFeeAmount = .()
	.NetworkFeeAmount = .()
	.TotalAmount = .()
	.PaymentMethod = .()
	.ExpiresDate = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *OnrampQuote) () tdp.Type {
	 := tdp.Type{
		Name: "onrampQuote",
		ID:   OnrampQuoteTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BaseCurrency",
			SchemaName: "base_currency",
		},
		{
			Name:       "BaseAmount",
			SchemaName: "base_amount",
		},
		{
			Name:       "CryptoCurrency",
			SchemaName: "crypto_currency",
		},
		{
			Name:       "CryptoAmount",
			SchemaName: "crypto_amount",
		},
		{
			Name:       "CryptoPrice",
			SchemaName: "crypto_price",
		},
		{
			Name:       "FeeAmount",
			SchemaName: "fee_amount",
		},
		{
			Name:       "ExtraFeeAmount",
			SchemaName: "extra_fee_amount",
		},
		{
			Name:       "NetworkFeeAmount",
			SchemaName: "network_fee_amount",
		},
		{
			Name:       "TotalAmount",
			SchemaName: "total_amount",
		},
		{
			Name:       "PaymentMethod",
			SchemaName: "payment_method",
		},
		{
			Name:       "ExpiresDate",
			SchemaName: "expires_date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *OnrampQuote) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode onrampQuote#7a8011e9 as nil")
	}
	.PutID(OnrampQuoteTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *OnrampQuote) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode onrampQuote#7a8011e9 as nil")
	}
	.PutString(.BaseCurrency)
	.PutString(.BaseAmount)
	.PutString(.CryptoCurrency)
	.PutString(.CryptoAmount)
	.PutString(.CryptoPrice)
	.PutString(.FeeAmount)
	.PutString(.ExtraFeeAmount)
	.PutString(.NetworkFeeAmount)
	.PutString(.TotalAmount)
	.PutString(.PaymentMethod)
	.PutInt(.ExpiresDate)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *OnrampQuote) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode onrampQuote#7a8011e9 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field base_currency: %w", )
		}
		.BaseCurrency = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field base_amount: %w", )
		}
		.BaseAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field crypto_currency: %w", )
		}
		.CryptoCurrency = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field crypto_amount: %w", )
		}
		.CryptoAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field crypto_price: %w", )
		}
		.CryptoPrice = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field fee_amount: %w", )
		}
		.FeeAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field extra_fee_amount: %w", )
		}
		.ExtraFeeAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field network_fee_amount: %w", )
		}
		.NetworkFeeAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field total_amount: %w", )
		}
		.TotalAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field payment_method: %w", )
		}
		.PaymentMethod = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode onrampQuote#7a8011e9: field expires_date: %w", )
		}
		.ExpiresDate = 
	}
	return nil
}

// GetBaseCurrency returns value of BaseCurrency field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .BaseCurrency
}

// GetBaseAmount returns value of BaseAmount field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .BaseAmount
}

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

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

// GetCryptoPrice returns value of CryptoPrice field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .CryptoPrice
}

// GetFeeAmount returns value of FeeAmount field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .FeeAmount
}

// GetExtraFeeAmount returns value of ExtraFeeAmount field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .ExtraFeeAmount
}

// GetNetworkFeeAmount returns value of NetworkFeeAmount field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .NetworkFeeAmount
}

// GetTotalAmount returns value of TotalAmount field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .TotalAmount
}

// GetPaymentMethod returns value of PaymentMethod field.
func ( *OnrampQuote) () ( string) {
	if  == nil {
		return
	}
	return .PaymentMethod
}

// GetExpiresDate returns value of ExpiresDate field.
func ( *OnrampQuote) () ( int) {
	if  == nil {
		return
	}
	return .ExpiresDate
}