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

// MessagesStickerSet represents TL type `messages.stickerSet#6e153f16`.
// Stickerset and stickers inside it
//
// See https://core.telegram.org/constructor/messages.stickerSet for reference.
type MessagesStickerSet struct {
	// The stickerset
	Set StickerSet
	// Emoji info for stickers
	Packs []StickerPack
	// Keywords for some or every sticker in the stickerset.
	Keywords []StickerKeyword
	// Stickers in stickerset
	Documents []DocumentClass
}

// MessagesStickerSetTypeID is TL type id of MessagesStickerSet.
const MessagesStickerSetTypeID = 0x6e153f16

// construct implements constructor of MessagesStickerSetClass.
func ( MessagesStickerSet) () MessagesStickerSetClass { return & }

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

	_ MessagesStickerSetClass = &MessagesStickerSet{}
)

func ( *MessagesStickerSet) () bool {
	if  == nil {
		return true
	}
	if !(.Set.Zero()) {
		return false
	}
	if !(.Packs == nil) {
		return false
	}
	if !(.Keywords == nil) {
		return false
	}
	if !(.Documents == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesStickerSet from given interface.
func ( *MessagesStickerSet) ( interface {
	() ( StickerSet)
	() ( []StickerPack)
	() ( []StickerKeyword)
	() ( []DocumentClass)
}) {
	.Set = .()
	.Packs = .()
	.Keywords = .()
	.Documents = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesStickerSet) () tdp.Type {
	 := tdp.Type{
		Name: "messages.stickerSet",
		ID:   MessagesStickerSetTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Set",
			SchemaName: "set",
		},
		{
			Name:       "Packs",
			SchemaName: "packs",
		},
		{
			Name:       "Keywords",
			SchemaName: "keywords",
		},
		{
			Name:       "Documents",
			SchemaName: "documents",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesStickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSet#6e153f16 as nil")
	}
	.PutID(MessagesStickerSetTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesStickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSet#6e153f16 as nil")
	}
	if  := .Set.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.stickerSet#6e153f16: field set: %w", )
	}
	.PutVectorHeader(len(.Packs))
	for ,  := range .Packs {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.stickerSet#6e153f16: field packs element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Keywords))
	for ,  := range .Keywords {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.stickerSet#6e153f16: field keywords element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Documents))
	for ,  := range .Documents {
		if  == nil {
			return fmt.Errorf("unable to encode messages.stickerSet#6e153f16: field documents element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.stickerSet#6e153f16: field documents element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesStickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.stickerSet#6e153f16 to nil")
	}
	{
		if  := .Set.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field set: %w", )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field packs: %w", )
		}

		if  > 0 {
			.Packs = make([]StickerPack, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  StickerPack
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field packs: %w", )
			}
			.Packs = append(.Packs, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field keywords: %w", )
		}

		if  > 0 {
			.Keywords = make([]StickerKeyword, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  StickerKeyword
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field keywords: %w", )
			}
			.Keywords = append(.Keywords, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field documents: %w", )
		}

		if  > 0 {
			.Documents = make([]DocumentClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeDocument()
			if  != nil {
				return fmt.Errorf("unable to decode messages.stickerSet#6e153f16: field documents: %w", )
			}
			.Documents = append(.Documents, )
		}
	}
	return nil
}

// GetSet returns value of Set field.
func ( *MessagesStickerSet) () ( StickerSet) {
	if  == nil {
		return
	}
	return .Set
}

// GetPacks returns value of Packs field.
func ( *MessagesStickerSet) () ( []StickerPack) {
	if  == nil {
		return
	}
	return .Packs
}

// GetKeywords returns value of Keywords field.
func ( *MessagesStickerSet) () ( []StickerKeyword) {
	if  == nil {
		return
	}
	return .Keywords
}

// GetDocuments returns value of Documents field.
func ( *MessagesStickerSet) () ( []DocumentClass) {
	if  == nil {
		return
	}
	return .Documents
}

// MapDocuments returns field Documents wrapped in DocumentClassArray helper.
func ( *MessagesStickerSet) () ( DocumentClassArray) {
	return DocumentClassArray(.Documents)
}

// MessagesStickerSetNotModified represents TL type `messages.stickerSetNotModified#d3f924eb`.
// The stickerset hasn't changed
//
// See https://core.telegram.org/constructor/messages.stickerSetNotModified for reference.
type MessagesStickerSetNotModified struct {
}

// MessagesStickerSetNotModifiedTypeID is TL type id of MessagesStickerSetNotModified.
const MessagesStickerSetNotModifiedTypeID = 0xd3f924eb

// construct implements constructor of MessagesStickerSetClass.
func ( MessagesStickerSetNotModified) () MessagesStickerSetClass { return & }

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

	_ MessagesStickerSetClass = &MessagesStickerSetNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesStickerSetNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickerSetNotModified#d3f924eb as nil")
	}
	.PutID(MessagesStickerSetNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesStickerSetClassName is schema name of MessagesStickerSetClass.
const MessagesStickerSetClassName = "messages.StickerSet"

// MessagesStickerSetClass represents messages.StickerSet generic type.
//
// See https://core.telegram.org/type/messages.StickerSet for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesStickerSet(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesStickerSet: // messages.stickerSet#6e153f16
//	case *tg.MessagesStickerSetNotModified: // messages.stickerSetNotModified#d3f924eb
//	default: panic(v)
//	}
type MessagesStickerSetClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesStickerSetClass

	// 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

	// AsModified tries to map MessagesStickerSetClass to MessagesStickerSet.
	AsModified() (*MessagesStickerSet, bool)
}

// AsModified tries to map MessagesStickerSet to MessagesStickerSet.
func ( *MessagesStickerSet) () (*MessagesStickerSet, bool) {
	return , true
}

// AsModified tries to map MessagesStickerSetNotModified to MessagesStickerSet.
func ( *MessagesStickerSetNotModified) () (*MessagesStickerSet, bool) {
	return nil, false
}

// DecodeMessagesStickerSet implements binary de-serialization for MessagesStickerSetClass.
func ( *bin.Buffer) (MessagesStickerSetClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesStickerSetTypeID:
		// Decoding messages.stickerSet#6e153f16.
		 := MessagesStickerSet{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickerSetClass: %w", )
		}
		return &, nil
	case MessagesStickerSetNotModifiedTypeID:
		// Decoding messages.stickerSetNotModified#d3f924eb.
		 := MessagesStickerSetNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickerSetClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesStickerSetClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesStickerSet boxes the MessagesStickerSetClass providing a helper.
type MessagesStickerSetBox struct {
	StickerSet MessagesStickerSetClass
}

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

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