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

// StickerPack represents TL type `stickerPack#12b299d4`.
// A stickerpack is a group of stickers associated to the same emoji.
// It is not a sticker pack the way it is usually intended, you may be looking for a
// StickerSet¹.
//
// Links:
//  1. https://core.telegram.org/type/StickerSet
//
// See https://core.telegram.org/constructor/stickerPack for reference.
type StickerPack struct {
	// Emoji
	Emoticon string
	// Stickers
	Documents []int64
}

// StickerPackTypeID is TL type id of StickerPack.
const StickerPackTypeID = 0x12b299d4

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

func ( *StickerPack) () bool {
	if  == nil {
		return true
	}
	if !(.Emoticon == "") {
		return false
	}
	if !(.Documents == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StickerPack from given interface.
func ( *StickerPack) ( interface {
	() ( string)
	() ( []int64)
}) {
	.Emoticon = .()
	.Documents = .()
}

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

// TypeName returns name of type in TL schema.
func (*StickerPack) () string {
	return "stickerPack"
}

// TypeInfo returns info about TL type.
func ( *StickerPack) () tdp.Type {
	 := tdp.Type{
		Name: "stickerPack",
		ID:   StickerPackTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Emoticon",
			SchemaName: "emoticon",
		},
		{
			Name:       "Documents",
			SchemaName: "documents",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StickerPack) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickerPack#12b299d4 as nil")
	}
	.PutID(StickerPackTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickerPack) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickerPack#12b299d4 as nil")
	}
	.PutString(.Emoticon)
	.PutVectorHeader(len(.Documents))
	for ,  := range .Documents {
		.PutLong()
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *StickerPack) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickerPack#12b299d4 to nil")
	}
	if  := .ConsumeID(StickerPackTypeID);  != nil {
		return fmt.Errorf("unable to decode stickerPack#12b299d4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StickerPack) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickerPack#12b299d4 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickerPack#12b299d4: field emoticon: %w", )
		}
		.Emoticon = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode stickerPack#12b299d4: field documents: %w", )
		}

		if  > 0 {
			.Documents = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode stickerPack#12b299d4: field documents: %w", )
			}
			.Documents = append(.Documents, )
		}
	}
	return nil
}

// GetEmoticon returns value of Emoticon field.
func ( *StickerPack) () ( string) {
	if  == nil {
		return
	}
	return .Emoticon
}

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