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

// OnrampLimits represents TL type `onrampLimits#7be2677e`.
//
// See https://core.telegram.org/constructor/onrampLimits for reference.
type OnrampLimits struct {
	// BaseCurrency field of OnrampLimits.
	BaseCurrency string
	// BaseMinAmount field of OnrampLimits.
	BaseMinAmount string
	// BaseMaxAmount field of OnrampLimits.
	BaseMaxAmount string
	// CryptoMinAmount field of OnrampLimits.
	CryptoMinAmount string
	// CryptoMaxAmount field of OnrampLimits.
	CryptoMaxAmount string
	// PaymentMethod field of OnrampLimits.
	PaymentMethod string
}

// OnrampLimitsTypeID is TL type id of OnrampLimits.
const OnrampLimitsTypeID = 0x7be2677e

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

func ( *OnrampLimits) () bool {
	if  == nil {
		return true
	}
	if !(.BaseCurrency == "") {
		return false
	}
	if !(.BaseMinAmount == "") {
		return false
	}
	if !(.BaseMaxAmount == "") {
		return false
	}
	if !(.CryptoMinAmount == "") {
		return false
	}
	if !(.CryptoMaxAmount == "") {
		return false
	}
	if !(.PaymentMethod == "") {
		return false
	}

	return true
}

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

// FillFrom fills OnrampLimits from given interface.
func ( *OnrampLimits) ( interface {
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
}) {
	.BaseCurrency = .()
	.BaseMinAmount = .()
	.BaseMaxAmount = .()
	.CryptoMinAmount = .()
	.CryptoMaxAmount = .()
	.PaymentMethod = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *OnrampLimits) () tdp.Type {
	 := tdp.Type{
		Name: "onrampLimits",
		ID:   OnrampLimitsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BaseCurrency",
			SchemaName: "base_currency",
		},
		{
			Name:       "BaseMinAmount",
			SchemaName: "base_min_amount",
		},
		{
			Name:       "BaseMaxAmount",
			SchemaName: "base_max_amount",
		},
		{
			Name:       "CryptoMinAmount",
			SchemaName: "crypto_min_amount",
		},
		{
			Name:       "CryptoMaxAmount",
			SchemaName: "crypto_max_amount",
		},
		{
			Name:       "PaymentMethod",
			SchemaName: "payment_method",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *OnrampLimits) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode onrampLimits#7be2677e as nil")
	}
	.PutID(OnrampLimitsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *OnrampLimits) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode onrampLimits#7be2677e as nil")
	}
	.PutString(.BaseCurrency)
	.PutString(.BaseMinAmount)
	.PutString(.BaseMaxAmount)
	.PutString(.CryptoMinAmount)
	.PutString(.CryptoMaxAmount)
	.PutString(.PaymentMethod)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *OnrampLimits) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode onrampLimits#7be2677e to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field base_currency: %w", )
		}
		.BaseCurrency = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field base_min_amount: %w", )
		}
		.BaseMinAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field base_max_amount: %w", )
		}
		.BaseMaxAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field crypto_min_amount: %w", )
		}
		.CryptoMinAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field crypto_max_amount: %w", )
		}
		.CryptoMaxAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode onrampLimits#7be2677e: field payment_method: %w", )
		}
		.PaymentMethod = 
	}
	return nil
}

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

// GetBaseMinAmount returns value of BaseMinAmount field.
func ( *OnrampLimits) () ( string) {
	if  == nil {
		return
	}
	return .BaseMinAmount
}

// GetBaseMaxAmount returns value of BaseMaxAmount field.
func ( *OnrampLimits) () ( string) {
	if  == nil {
		return
	}
	return .BaseMaxAmount
}

// GetCryptoMinAmount returns value of CryptoMinAmount field.
func ( *OnrampLimits) () ( string) {
	if  == nil {
		return
	}
	return .CryptoMinAmount
}

// GetCryptoMaxAmount returns value of CryptoMaxAmount field.
func ( *OnrampLimits) () ( string) {
	if  == nil {
		return
	}
	return .CryptoMaxAmount
}

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