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

// StarGiftUpgradePrice represents TL type `starGiftUpgradePrice#99ea331d`.
// Indicates the price for a gift upgrade »¹ starting from a specific point in time.
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//
// See https://core.telegram.org/constructor/starGiftUpgradePrice for reference.
type StarGiftUpgradePrice struct {
	// UNIX timestamp indicating when the price will be in effect.
	Date int
	// Upgrade price.
	UpgradeStars int64
}

// StarGiftUpgradePriceTypeID is TL type id of StarGiftUpgradePrice.
const StarGiftUpgradePriceTypeID = 0x99ea331d

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

func ( *StarGiftUpgradePrice) () bool {
	if  == nil {
		return true
	}
	if !(.Date == 0) {
		return false
	}
	if !(.UpgradeStars == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StarGiftUpgradePrice from given interface.
func ( *StarGiftUpgradePrice) ( interface {
	() ( int)
	() ( int64)
}) {
	.Date = .()
	.UpgradeStars = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StarGiftUpgradePrice) () tdp.Type {
	 := tdp.Type{
		Name: "starGiftUpgradePrice",
		ID:   StarGiftUpgradePriceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "UpgradeStars",
			SchemaName: "upgrade_stars",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StarGiftUpgradePrice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode starGiftUpgradePrice#99ea331d as nil")
	}
	.PutID(StarGiftUpgradePriceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StarGiftUpgradePrice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode starGiftUpgradePrice#99ea331d as nil")
	}
	.PutInt(.Date)
	.PutLong(.UpgradeStars)
	return nil
}

// Decode implements bin.Decoder.
func ( *StarGiftUpgradePrice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode starGiftUpgradePrice#99ea331d to nil")
	}
	if  := .ConsumeID(StarGiftUpgradePriceTypeID);  != nil {
		return fmt.Errorf("unable to decode starGiftUpgradePrice#99ea331d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StarGiftUpgradePrice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode starGiftUpgradePrice#99ea331d to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode starGiftUpgradePrice#99ea331d: field date: %w", )
		}
		.Date = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode starGiftUpgradePrice#99ea331d: field upgrade_stars: %w", )
		}
		.UpgradeStars = 
	}
	return nil
}

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

// GetUpgradeStars returns value of UpgradeStars field.
func ( *StarGiftUpgradePrice) () ( int64) {
	if  == nil {
		return
	}
	return .UpgradeStars
}