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

// AuctionBidLevel represents TL type `auctionBidLevel#310240cc`.
// Describes a bid in an auction¹.
//
// Links:
//  1. https://core.telegram.org/api/auctions
//
// See https://core.telegram.org/constructor/auctionBidLevel for reference.
type AuctionBidLevel struct {
	// Position of the bid.
	Pos int
	// Amount of the bid in Telegram Stars¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/stars
	Amount int64
	// Date when the bid was placed.
	Date int
}

// AuctionBidLevelTypeID is TL type id of AuctionBidLevel.
const AuctionBidLevelTypeID = 0x310240cc

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

func ( *AuctionBidLevel) () bool {
	if  == nil {
		return true
	}
	if !(.Pos == 0) {
		return false
	}
	if !(.Amount == 0) {
		return false
	}
	if !(.Date == 0) {
		return false
	}

	return true
}

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

// FillFrom fills AuctionBidLevel from given interface.
func ( *AuctionBidLevel) ( interface {
	() ( int)
	() ( int64)
	() ( int)
}) {
	.Pos = .()
	.Amount = .()
	.Date = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AuctionBidLevel) () tdp.Type {
	 := tdp.Type{
		Name: "auctionBidLevel",
		ID:   AuctionBidLevelTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Pos",
			SchemaName: "pos",
		},
		{
			Name:       "Amount",
			SchemaName: "amount",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuctionBidLevel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auctionBidLevel#310240cc as nil")
	}
	.PutID(AuctionBidLevelTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuctionBidLevel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auctionBidLevel#310240cc as nil")
	}
	.PutInt(.Pos)
	.PutLong(.Amount)
	.PutInt(.Date)
	return nil
}

// Decode implements bin.Decoder.
func ( *AuctionBidLevel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auctionBidLevel#310240cc to nil")
	}
	if  := .ConsumeID(AuctionBidLevelTypeID);  != nil {
		return fmt.Errorf("unable to decode auctionBidLevel#310240cc: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AuctionBidLevel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auctionBidLevel#310240cc to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field pos: %w", )
		}
		.Pos = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field amount: %w", )
		}
		.Amount = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field date: %w", )
		}
		.Date = 
	}
	return nil
}

// GetPos returns value of Pos field.
func ( *AuctionBidLevel) () ( int) {
	if  == nil {
		return
	}
	return .Pos
}

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

// GetDate returns value of Date field.
func ( *AuctionBidLevel) () ( int) {
	if  == nil {
		return
	}
	return .Date
}