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

// PaymentsUpdateStarGiftPriceRequest represents TL type `payments.updateStarGiftPrice#edbe6ccb`.
// A collectible gift we own »¹ can be put up for sale on the gift marketplace »²
// with this method, see here »³ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://telegram.org/blog/gift-marketplace-and-more
//  3. https://core.telegram.org/api/gifts#reselling-collectible-gifts
//
// See https://core.telegram.org/method/payments.updateStarGiftPrice for reference.
type PaymentsUpdateStarGiftPriceRequest struct {
	// The gift to resell.
	Stargift InputSavedStarGiftClass
	// Resale price of the gift.
	ResellAmount StarsAmountClass
}

// PaymentsUpdateStarGiftPriceRequestTypeID is TL type id of PaymentsUpdateStarGiftPriceRequest.
const PaymentsUpdateStarGiftPriceRequestTypeID = 0xedbe6ccb

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

func ( *PaymentsUpdateStarGiftPriceRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Stargift == nil) {
		return false
	}
	if !(.ResellAmount == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsUpdateStarGiftPriceRequest from given interface.
func ( *PaymentsUpdateStarGiftPriceRequest) ( interface {
	() ( InputSavedStarGiftClass)
	() ( StarsAmountClass)
}) {
	.Stargift = .()
	.ResellAmount = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsUpdateStarGiftPriceRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.updateStarGiftPrice",
		ID:   PaymentsUpdateStarGiftPriceRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Stargift",
			SchemaName: "stargift",
		},
		{
			Name:       "ResellAmount",
			SchemaName: "resell_amount",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsUpdateStarGiftPriceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.updateStarGiftPrice#edbe6ccb as nil")
	}
	.PutID(PaymentsUpdateStarGiftPriceRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsUpdateStarGiftPriceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.updateStarGiftPrice#edbe6ccb as nil")
	}
	if .Stargift == nil {
		return fmt.Errorf("unable to encode payments.updateStarGiftPrice#edbe6ccb: field stargift is nil")
	}
	if  := .Stargift.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.updateStarGiftPrice#edbe6ccb: field stargift: %w", )
	}
	if .ResellAmount == nil {
		return fmt.Errorf("unable to encode payments.updateStarGiftPrice#edbe6ccb: field resell_amount is nil")
	}
	if  := .ResellAmount.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.updateStarGiftPrice#edbe6ccb: field resell_amount: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsUpdateStarGiftPriceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.updateStarGiftPrice#edbe6ccb to nil")
	}
	{
		,  := DecodeInputSavedStarGift()
		if  != nil {
			return fmt.Errorf("unable to decode payments.updateStarGiftPrice#edbe6ccb: field stargift: %w", )
		}
		.Stargift = 
	}
	{
		,  := DecodeStarsAmount()
		if  != nil {
			return fmt.Errorf("unable to decode payments.updateStarGiftPrice#edbe6ccb: field resell_amount: %w", )
		}
		.ResellAmount = 
	}
	return nil
}

// GetStargift returns value of Stargift field.
func ( *PaymentsUpdateStarGiftPriceRequest) () ( InputSavedStarGiftClass) {
	if  == nil {
		return
	}
	return .Stargift
}

// GetResellAmount returns value of ResellAmount field.
func ( *PaymentsUpdateStarGiftPriceRequest) () ( StarsAmountClass) {
	if  == nil {
		return
	}
	return .ResellAmount
}

// PaymentsUpdateStarGiftPrice invokes method payments.updateStarGiftPrice#edbe6ccb returning error if any.
// A collectible gift we own »¹ can be put up for sale on the gift marketplace »²
// with this method, see here »³ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://telegram.org/blog/gift-marketplace-and-more
//  3. https://core.telegram.org/api/gifts#reselling-collectible-gifts
//
// Possible errors:
//
//	400 SAVED_ID_EMPTY: The passed inputSavedStarGiftChat.saved_id is empty.
//	400 STARGIFT_NOT_FOUND: The specified gift was not found.
//
// See https://core.telegram.org/method/payments.updateStarGiftPrice for reference.
func ( *Client) ( context.Context,  *PaymentsUpdateStarGiftPriceRequest) (UpdatesClass, error) {
	var  UpdatesBox

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