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

// InputStarGiftAuction represents TL type `inputStarGiftAuction#2e16c98`.
// Used to fetch auctions¹ using the ID of the linked collectible gift².
//
// Links:
//  1. https://core.telegram.org/api/auctions
//  2. https://core.telegram.org/api/gifts#collectible-gifts
//
// See https://core.telegram.org/constructor/inputStarGiftAuction for reference.
type InputStarGiftAuction struct {
	// Collectible gift ID¹
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	GiftID int64
}

// InputStarGiftAuctionTypeID is TL type id of InputStarGiftAuction.
const InputStarGiftAuctionTypeID = 0x2e16c98

// construct implements constructor of InputStarGiftAuctionClass.
func ( InputStarGiftAuction) () InputStarGiftAuctionClass { return & }

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

	_ InputStarGiftAuctionClass = &InputStarGiftAuction{}
)

func ( *InputStarGiftAuction) () bool {
	if  == nil {
		return true
	}
	if !(.GiftID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputStarGiftAuction from given interface.
func ( *InputStarGiftAuction) ( interface {
	() ( int64)
}) {
	.GiftID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputStarGiftAuction) () tdp.Type {
	 := tdp.Type{
		Name: "inputStarGiftAuction",
		ID:   InputStarGiftAuctionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GiftID",
			SchemaName: "gift_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputStarGiftAuction) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStarGiftAuction#2e16c98 as nil")
	}
	.PutID(InputStarGiftAuctionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputStarGiftAuction) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStarGiftAuction#2e16c98 as nil")
	}
	.PutLong(.GiftID)
	return nil
}

// Decode implements bin.Decoder.
func ( *InputStarGiftAuction) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputStarGiftAuction#2e16c98 to nil")
	}
	if  := .ConsumeID(InputStarGiftAuctionTypeID);  != nil {
		return fmt.Errorf("unable to decode inputStarGiftAuction#2e16c98: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputStarGiftAuction) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputStarGiftAuction#2e16c98 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputStarGiftAuction#2e16c98: field gift_id: %w", )
		}
		.GiftID = 
	}
	return nil
}

// GetGiftID returns value of GiftID field.
func ( *InputStarGiftAuction) () ( int64) {
	if  == nil {
		return
	}
	return .GiftID
}

// InputStarGiftAuctionSlug represents TL type `inputStarGiftAuctionSlug#7ab58308`.
// Used to fetch auctions¹ using the slug of an auction deep link »².
//
// Links:
//  1. https://core.telegram.org/api/auctions
//  2. https://core.telegram.org/api/links#auction-links
//
// See https://core.telegram.org/constructor/inputStarGiftAuctionSlug for reference.
type InputStarGiftAuctionSlug struct {
	// Auction deep link slug »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#auction-links
	Slug string
}

// InputStarGiftAuctionSlugTypeID is TL type id of InputStarGiftAuctionSlug.
const InputStarGiftAuctionSlugTypeID = 0x7ab58308

// construct implements constructor of InputStarGiftAuctionClass.
func ( InputStarGiftAuctionSlug) () InputStarGiftAuctionClass { return & }

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

	_ InputStarGiftAuctionClass = &InputStarGiftAuctionSlug{}
)

func ( *InputStarGiftAuctionSlug) () bool {
	if  == nil {
		return true
	}
	if !(.Slug == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputStarGiftAuctionSlug from given interface.
func ( *InputStarGiftAuctionSlug) ( interface {
	() ( string)
}) {
	.Slug = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputStarGiftAuctionSlug) () tdp.Type {
	 := tdp.Type{
		Name: "inputStarGiftAuctionSlug",
		ID:   InputStarGiftAuctionSlugTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Slug",
			SchemaName: "slug",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputStarGiftAuctionSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStarGiftAuctionSlug#7ab58308 as nil")
	}
	.PutID(InputStarGiftAuctionSlugTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputStarGiftAuctionSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStarGiftAuctionSlug#7ab58308 as nil")
	}
	.PutString(.Slug)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputStarGiftAuctionSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputStarGiftAuctionSlug#7ab58308 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputStarGiftAuctionSlug#7ab58308: field slug: %w", )
		}
		.Slug = 
	}
	return nil
}

// GetSlug returns value of Slug field.
func ( *InputStarGiftAuctionSlug) () ( string) {
	if  == nil {
		return
	}
	return .Slug
}

// InputStarGiftAuctionClassName is schema name of InputStarGiftAuctionClass.
const InputStarGiftAuctionClassName = "InputStarGiftAuction"

// InputStarGiftAuctionClass represents InputStarGiftAuction generic type.
//
// See https://core.telegram.org/type/InputStarGiftAuction for reference.
//
// Constructors:
//   - [InputStarGiftAuction]
//   - [InputStarGiftAuctionSlug]
//
// Example:
//
//	g, err := tg.DecodeInputStarGiftAuction(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputStarGiftAuction: // inputStarGiftAuction#2e16c98
//	case *tg.InputStarGiftAuctionSlug: // inputStarGiftAuctionSlug#7ab58308
//	default: panic(v)
//	}
type InputStarGiftAuctionClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputStarGiftAuctionClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeInputStarGiftAuction implements binary de-serialization for InputStarGiftAuctionClass.
func ( *bin.Buffer) (InputStarGiftAuctionClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputStarGiftAuctionTypeID:
		// Decoding inputStarGiftAuction#2e16c98.
		 := InputStarGiftAuction{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", )
		}
		return &, nil
	case InputStarGiftAuctionSlugTypeID:
		// Decoding inputStarGiftAuctionSlug#7ab58308.
		 := InputStarGiftAuctionSlug{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", bin.NewUnexpectedID())
	}
}

// InputStarGiftAuction boxes the InputStarGiftAuctionClass providing a helper.
type InputStarGiftAuctionBox struct {
	InputStarGiftAuction InputStarGiftAuctionClass
}

// Decode implements bin.Decoder for InputStarGiftAuctionBox.
func ( *InputStarGiftAuctionBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode InputStarGiftAuctionBox to nil")
	}
	,  := DecodeInputStarGiftAuction()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.InputStarGiftAuction = 
	return nil
}

// Encode implements bin.Encode for InputStarGiftAuctionBox.
func ( *InputStarGiftAuctionBox) ( *bin.Buffer) error {
	if  == nil || .InputStarGiftAuction == nil {
		return fmt.Errorf("unable to encode InputStarGiftAuctionClass as nil")
	}
	return .InputStarGiftAuction.Encode()
}