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

// MessagesStickerSetInstallResultSuccess represents TL type `messages.stickerSetInstallResultSuccess#38641628`.
// The stickerset was installed successfully
//
// See https://core.telegram.org/constructor/messages.stickerSetInstallResultSuccess for reference.
type MessagesStickerSetInstallResultSuccess struct {
}

// MessagesStickerSetInstallResultSuccessTypeID is TL type id of MessagesStickerSetInstallResultSuccess.
const MessagesStickerSetInstallResultSuccessTypeID = 0x38641628

// construct implements constructor of MessagesStickerSetInstallResultClass.
func ( MessagesStickerSetInstallResultSuccess) () MessagesStickerSetInstallResultClass {
	return &
}

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

	_ MessagesStickerSetInstallResultClass = &MessagesStickerSetInstallResultSuccess{}
)

func ( *MessagesStickerSetInstallResultSuccess) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*MessagesStickerSetInstallResultSuccess) () string {
	return "messages.stickerSetInstallResultSuccess"
}

// TypeInfo returns info about TL type.
func ( *MessagesStickerSetInstallResultSuccess) () tdp.Type {
	 := tdp.Type{
		Name: "messages.stickerSetInstallResultSuccess",
		ID:   MessagesStickerSetInstallResultSuccessTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesStickerSetInstallResultSuccess) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSetInstallResultSuccess#38641628 as nil")
	}
	.PutID(MessagesStickerSetInstallResultSuccessTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesStickerSetInstallResultSuccess) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSetInstallResultSuccess#38641628 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesStickerSetInstallResultSuccess) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.stickerSetInstallResultSuccess#38641628 to nil")
	}
	if  := .ConsumeID(MessagesStickerSetInstallResultSuccessTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.stickerSetInstallResultSuccess#38641628: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesStickerSetInstallResultSuccess) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.stickerSetInstallResultSuccess#38641628 to nil")
	}
	return nil
}

// MessagesStickerSetInstallResultArchive represents TL type `messages.stickerSetInstallResultArchive#35e410a8`.
// The stickerset was installed, but since there are too many stickersets some were
// archived
//
// See https://core.telegram.org/constructor/messages.stickerSetInstallResultArchive for reference.
type MessagesStickerSetInstallResultArchive struct {
	// Archived stickersets
	Sets []StickerSetCoveredClass
}

// MessagesStickerSetInstallResultArchiveTypeID is TL type id of MessagesStickerSetInstallResultArchive.
const MessagesStickerSetInstallResultArchiveTypeID = 0x35e410a8

// construct implements constructor of MessagesStickerSetInstallResultClass.
func ( MessagesStickerSetInstallResultArchive) () MessagesStickerSetInstallResultClass {
	return &
}

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

	_ MessagesStickerSetInstallResultClass = &MessagesStickerSetInstallResultArchive{}
)

func ( *MessagesStickerSetInstallResultArchive) () bool {
	if  == nil {
		return true
	}
	if !(.Sets == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesStickerSetInstallResultArchive from given interface.
func ( *MessagesStickerSetInstallResultArchive) ( interface {
	() ( []StickerSetCoveredClass)
}) {
	.Sets = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesStickerSetInstallResultArchive) () string {
	return "messages.stickerSetInstallResultArchive"
}

// TypeInfo returns info about TL type.
func ( *MessagesStickerSetInstallResultArchive) () tdp.Type {
	 := tdp.Type{
		Name: "messages.stickerSetInstallResultArchive",
		ID:   MessagesStickerSetInstallResultArchiveTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Sets",
			SchemaName: "sets",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesStickerSetInstallResultArchive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSetInstallResultArchive#35e410a8 as nil")
	}
	.PutID(MessagesStickerSetInstallResultArchiveTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesStickerSetInstallResultArchive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSetInstallResultArchive#35e410a8 as nil")
	}
	.PutVectorHeader(len(.Sets))
	for ,  := range .Sets {
		if  == nil {
			return fmt.Errorf("unable to encode messages.stickerSetInstallResultArchive#35e410a8: field sets element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.stickerSetInstallResultArchive#35e410a8: field sets element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesStickerSetInstallResultArchive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.stickerSetInstallResultArchive#35e410a8 to nil")
	}
	if  := .ConsumeID(MessagesStickerSetInstallResultArchiveTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.stickerSetInstallResultArchive#35e410a8: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesStickerSetInstallResultArchive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.stickerSetInstallResultArchive#35e410a8 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.stickerSetInstallResultArchive#35e410a8: field sets: %w", )
		}

		if  > 0 {
			.Sets = make([]StickerSetCoveredClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeStickerSetCovered()
			if  != nil {
				return fmt.Errorf("unable to decode messages.stickerSetInstallResultArchive#35e410a8: field sets: %w", )
			}
			.Sets = append(.Sets, )
		}
	}
	return nil
}

// GetSets returns value of Sets field.
func ( *MessagesStickerSetInstallResultArchive) () ( []StickerSetCoveredClass) {
	if  == nil {
		return
	}
	return .Sets
}

// MapSets returns field Sets wrapped in StickerSetCoveredClassArray helper.
func ( *MessagesStickerSetInstallResultArchive) () ( StickerSetCoveredClassArray) {
	return StickerSetCoveredClassArray(.Sets)
}

// MessagesStickerSetInstallResultClassName is schema name of MessagesStickerSetInstallResultClass.
const MessagesStickerSetInstallResultClassName = "messages.StickerSetInstallResult"

// MessagesStickerSetInstallResultClass represents messages.StickerSetInstallResult generic type.
//
// See https://core.telegram.org/type/messages.StickerSetInstallResult for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesStickerSetInstallResult(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesStickerSetInstallResultSuccess: // messages.stickerSetInstallResultSuccess#38641628
//	case *tg.MessagesStickerSetInstallResultArchive: // messages.stickerSetInstallResultArchive#35e410a8
//	default: panic(v)
//	}
type MessagesStickerSetInstallResultClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesStickerSetInstallResultClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeMessagesStickerSetInstallResult implements binary de-serialization for MessagesStickerSetInstallResultClass.
func ( *bin.Buffer) (MessagesStickerSetInstallResultClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesStickerSetInstallResultSuccessTypeID:
		// Decoding messages.stickerSetInstallResultSuccess#38641628.
		 := MessagesStickerSetInstallResultSuccess{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickerSetInstallResultClass: %w", )
		}
		return &, nil
	case MessagesStickerSetInstallResultArchiveTypeID:
		// Decoding messages.stickerSetInstallResultArchive#35e410a8.
		 := MessagesStickerSetInstallResultArchive{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickerSetInstallResultClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesStickerSetInstallResultClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesStickerSetInstallResult boxes the MessagesStickerSetInstallResultClass providing a helper.
type MessagesStickerSetInstallResultBox struct {
	StickerSetInstallResult MessagesStickerSetInstallResultClass
}

// Decode implements bin.Decoder for MessagesStickerSetInstallResultBox.
func ( *MessagesStickerSetInstallResultBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode MessagesStickerSetInstallResultBox to nil")
	}
	,  := DecodeMessagesStickerSetInstallResult()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.StickerSetInstallResult = 
	return nil
}

// Encode implements bin.Encode for MessagesStickerSetInstallResultBox.
func ( *MessagesStickerSetInstallResultBox) ( *bin.Buffer) error {
	if  == nil || .StickerSetInstallResult == nil {
		return fmt.Errorf("unable to encode MessagesStickerSetInstallResultClass as nil")
	}
	return .StickerSetInstallResult.Encode()
}