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

// FragmentGetCollectibleInfoRequest represents TL type `fragment.getCollectibleInfo#be1e85ba`.
// Fetch information about a fragment collectible, see here »¹ for more info on the
// full flow.
//
// Links:
//  1. https://core.telegram.org/api/fragment#fetching-info-about-fragment-collectibles
//
// See https://core.telegram.org/method/fragment.getCollectibleInfo for reference.
type FragmentGetCollectibleInfoRequest struct {
	// Collectible to fetch info about.
	Collectible InputCollectibleClass
}

// FragmentGetCollectibleInfoRequestTypeID is TL type id of FragmentGetCollectibleInfoRequest.
const FragmentGetCollectibleInfoRequestTypeID = 0xbe1e85ba

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

func ( *FragmentGetCollectibleInfoRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Collectible == nil) {
		return false
	}

	return true
}

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

// FillFrom fills FragmentGetCollectibleInfoRequest from given interface.
func ( *FragmentGetCollectibleInfoRequest) ( interface {
	() ( InputCollectibleClass)
}) {
	.Collectible = .()
}

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

// TypeName returns name of type in TL schema.
func (*FragmentGetCollectibleInfoRequest) () string {
	return "fragment.getCollectibleInfo"
}

// TypeInfo returns info about TL type.
func ( *FragmentGetCollectibleInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "fragment.getCollectibleInfo",
		ID:   FragmentGetCollectibleInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Collectible",
			SchemaName: "collectible",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *FragmentGetCollectibleInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode fragment.getCollectibleInfo#be1e85ba as nil")
	}
	.PutID(FragmentGetCollectibleInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *FragmentGetCollectibleInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode fragment.getCollectibleInfo#be1e85ba as nil")
	}
	if .Collectible == nil {
		return fmt.Errorf("unable to encode fragment.getCollectibleInfo#be1e85ba: field collectible is nil")
	}
	if  := .Collectible.Encode();  != nil {
		return fmt.Errorf("unable to encode fragment.getCollectibleInfo#be1e85ba: field collectible: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *FragmentGetCollectibleInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode fragment.getCollectibleInfo#be1e85ba to nil")
	}
	if  := .ConsumeID(FragmentGetCollectibleInfoRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode fragment.getCollectibleInfo#be1e85ba: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *FragmentGetCollectibleInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode fragment.getCollectibleInfo#be1e85ba to nil")
	}
	{
		,  := DecodeInputCollectible()
		if  != nil {
			return fmt.Errorf("unable to decode fragment.getCollectibleInfo#be1e85ba: field collectible: %w", )
		}
		.Collectible = 
	}
	return nil
}

// GetCollectible returns value of Collectible field.
func ( *FragmentGetCollectibleInfoRequest) () ( InputCollectibleClass) {
	if  == nil {
		return
	}
	return .Collectible
}

// FragmentGetCollectibleInfo invokes method fragment.getCollectibleInfo#be1e85ba returning error if any.
// Fetch information about a fragment collectible, see here »¹ for more info on the
// full flow.
//
// Links:
//  1. https://core.telegram.org/api/fragment#fetching-info-about-fragment-collectibles
//
// Possible errors:
//
//	400 COLLECTIBLE_INVALID: The specified collectible is invalid.
//	400 COLLECTIBLE_NOT_FOUND: The specified collectible could not be found.
//
// See https://core.telegram.org/method/fragment.getCollectibleInfo for reference.
func ( *Client) ( context.Context,  InputCollectibleClass) (*FragmentCollectibleInfo, error) {
	var  FragmentCollectibleInfo

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