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

// PaymentsDeleteStarGiftCollectionRequest represents TL type `payments.deleteStarGiftCollection#ad5648e8`.
// Delete a star gift collection »¹.
//
// Links:
//  1. https://core.telegram.org/api/gifts#gift-collections
//
// See https://core.telegram.org/method/payments.deleteStarGiftCollection for reference.
type PaymentsDeleteStarGiftCollectionRequest struct {
	// Peer that owns the collection.
	Peer InputPeerClass
	// ID of the collection.
	CollectionID int
}

// PaymentsDeleteStarGiftCollectionRequestTypeID is TL type id of PaymentsDeleteStarGiftCollectionRequest.
const PaymentsDeleteStarGiftCollectionRequestTypeID = 0xad5648e8

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

func ( *PaymentsDeleteStarGiftCollectionRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.CollectionID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsDeleteStarGiftCollectionRequest from given interface.
func ( *PaymentsDeleteStarGiftCollectionRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.CollectionID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsDeleteStarGiftCollectionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.deleteStarGiftCollection",
		ID:   PaymentsDeleteStarGiftCollectionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "CollectionID",
			SchemaName: "collection_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsDeleteStarGiftCollectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.deleteStarGiftCollection#ad5648e8 as nil")
	}
	.PutID(PaymentsDeleteStarGiftCollectionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsDeleteStarGiftCollectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.deleteStarGiftCollection#ad5648e8 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode payments.deleteStarGiftCollection#ad5648e8: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.deleteStarGiftCollection#ad5648e8: field peer: %w", )
	}
	.PutInt(.CollectionID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsDeleteStarGiftCollectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.deleteStarGiftCollection#ad5648e8 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.deleteStarGiftCollection#ad5648e8: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode payments.deleteStarGiftCollection#ad5648e8: field collection_id: %w", )
		}
		.CollectionID = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *PaymentsDeleteStarGiftCollectionRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetCollectionID returns value of CollectionID field.
func ( *PaymentsDeleteStarGiftCollectionRequest) () ( int) {
	if  == nil {
		return
	}
	return .CollectionID
}

// PaymentsDeleteStarGiftCollection invokes method payments.deleteStarGiftCollection#ad5648e8 returning error if any.
// Delete a star gift collection »¹.
//
// Links:
//  1. https://core.telegram.org/api/gifts#gift-collections
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/payments.deleteStarGiftCollection for reference.
func ( *Client) ( context.Context,  *PaymentsDeleteStarGiftCollectionRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}