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

// PaymentsGetStarGiftUpgradeAttributesRequest represents TL type `payments.getStarGiftUpgradeAttributes#6d038b58`.
// Obtains the full list of just the collectible attributes that may appear for a gift
// type once it's upgraded to a collectible gift »¹.
// The result may also include starGiftAttributeModel¹ constructors with the crafted
// flag set: these models are reserved for crafting »² and should be filtered out from
// regular upgrade previews (and vice versa).
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://core.telegram.org/constructor/starGiftAttributeModel
//  3. https://core.telegram.org/api/gifts#crafting-collectible-gifts
//
// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference.
type PaymentsGetStarGiftUpgradeAttributesRequest struct {
	// Non-collectible base gift ID, from starGift¹.id
	//
	// Links:
	//  1) https://core.telegram.org/constructor/starGift
	GiftID int64
}

// PaymentsGetStarGiftUpgradeAttributesRequestTypeID is TL type id of PaymentsGetStarGiftUpgradeAttributesRequest.
const PaymentsGetStarGiftUpgradeAttributesRequestTypeID = 0x6d038b58

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *PaymentsGetStarGiftUpgradeAttributesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil")
	}
	.PutID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarGiftUpgradeAttributesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil")
	}
	.PutLong(.GiftID)
	return nil
}

// Decode implements bin.Decoder.
func ( *PaymentsGetStarGiftUpgradeAttributesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil")
	}
	if  := .ConsumeID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: %w", )
	}
	return .DecodeBare()
}

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

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

// PaymentsGetStarGiftUpgradeAttributes invokes method payments.getStarGiftUpgradeAttributes#6d038b58 returning error if any.
// Obtains the full list of just the collectible attributes that may appear for a gift
// type once it's upgraded to a collectible gift »¹.
// The result may also include starGiftAttributeModel¹ constructors with the crafted
// flag set: these models are reserved for crafting »² and should be filtered out from
// regular upgrade previews (and vice versa).
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://core.telegram.org/constructor/starGiftAttributeModel
//  3. https://core.telegram.org/api/gifts#crafting-collectible-gifts
//
// Possible errors:
//
//	400 STARGIFT_INVALID: The passed gift is invalid.
//
// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference.
func ( *Client) ( context.Context,  int64) (*PaymentsStarGiftUpgradeAttributes, error) {
	var  PaymentsStarGiftUpgradeAttributes

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