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

// PaymentsGetStarGiftUpgradePreviewRequest represents TL type `payments.getStarGiftUpgradePreview#9c9abcb1`.
// Obtain a preview of the possible attributes (chosen randomly) a gift »¹ can receive
// after upgrading it to a collectible gift »², see here »³ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts
//  2. https://core.telegram.org/api/gifts#collectible-gifts
//  3. https://core.telegram.org/api/gifts#collectible-gifts
//
// See https://core.telegram.org/method/payments.getStarGiftUpgradePreview for reference.
type PaymentsGetStarGiftUpgradePreviewRequest struct {
	// The gift to upgrade.
	GiftID int64
}

// PaymentsGetStarGiftUpgradePreviewRequestTypeID is TL type id of PaymentsGetStarGiftUpgradePreviewRequest.
const PaymentsGetStarGiftUpgradePreviewRequestTypeID = 0x9c9abcb1

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*PaymentsGetStarGiftUpgradePreviewRequest) () string {
	return "payments.getStarGiftUpgradePreview"
}

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

// Encode implements bin.Encoder.
func ( *PaymentsGetStarGiftUpgradePreviewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftUpgradePreview#9c9abcb1 as nil")
	}
	.PutID(PaymentsGetStarGiftUpgradePreviewRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarGiftUpgradePreviewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftUpgradePreview#9c9abcb1 as nil")
	}
	.PutLong(.GiftID)
	return nil
}

// Decode implements bin.Decoder.
func ( *PaymentsGetStarGiftUpgradePreviewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarGiftUpgradePreview#9c9abcb1 to nil")
	}
	if  := .ConsumeID(PaymentsGetStarGiftUpgradePreviewRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getStarGiftUpgradePreview#9c9abcb1: %w", )
	}
	return .DecodeBare()
}

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

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

// PaymentsGetStarGiftUpgradePreview invokes method payments.getStarGiftUpgradePreview#9c9abcb1 returning error if any.
// Obtain a preview of the possible attributes (chosen randomly) a gift »¹ can receive
// after upgrading it to a collectible gift »², see here »³ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts
//  2. https://core.telegram.org/api/gifts#collectible-gifts
//  3. https://core.telegram.org/api/gifts#collectible-gifts
//
// Possible errors:
//
//	400 STARGIFT_INVALID: The passed gift is invalid.
//	400 STARGIFT_UPGRADE_UNAVAILABLE: A received gift can only be upgraded to a collectible gift if the messageActionStarGift/savedStarGift.can_upgrade flag is set.
//
// See https://core.telegram.org/method/payments.getStarGiftUpgradePreview for reference.
func ( *Client) ( context.Context,  int64) (*PaymentsStarGiftUpgradePreview, error) {
	var  PaymentsStarGiftUpgradePreview

	 := &PaymentsGetStarGiftUpgradePreviewRequest{
		GiftID: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}