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

// StickerSet represents TL type `stickerSet#2dd14edc`.
// Represents a stickerset (stickerpack)
//
// See https://core.telegram.org/constructor/stickerSet for reference.
type StickerSet struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this stickerset was archived (due to too many saved stickers in the current
	// account)
	Archived bool
	// Is this stickerset official
	Official bool
	// Is this a mask stickerset
	Masks bool
	// Is this an animated stickerpack
	Animated bool
	// Is this a video stickerpack
	Videos bool
	// This is a custom emoji stickerset
	Emojis bool
	// Whether the color of this TGS custom emoji stickerset should be changed to the text
	// color when used in messages, the accent color if used as emoji status, white on chat
	// photos, or another appropriate color based on context.
	TextColor bool
	// ChannelEmojiStatus field of StickerSet.
	ChannelEmojiStatus bool
	// When was this stickerset installed
	//
	// Use SetInstalledDate and GetInstalledDate helpers.
	InstalledDate int
	// ID of the stickerset
	ID int64
	// Access hash of stickerset
	AccessHash int64
	// Title of stickerset
	Title string
	// Short name of stickerset, used when sharing stickerset using stickerset deep links¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#stickerset-links
	ShortName string
	// Stickerset thumbnail
	//
	// Use SetThumbs and GetThumbs helpers.
	Thumbs []PhotoSizeClass
	// DC ID of thumbnail
	//
	// Use SetThumbDCID and GetThumbDCID helpers.
	ThumbDCID int
	// Thumbnail version
	//
	// Use SetThumbVersion and GetThumbVersion helpers.
	ThumbVersion int
	// Document ID of custom emoji thumbnail, fetch the document using messages
	// getCustomEmojiDocuments¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.getCustomEmojiDocuments
	//
	// Use SetThumbDocumentID and GetThumbDocumentID helpers.
	ThumbDocumentID int64
	// Number of stickers in pack
	Count int
	// Hash
	Hash int
}

// StickerSetTypeID is TL type id of StickerSet.
const StickerSetTypeID = 0x2dd14edc

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

func ( *StickerSet) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Archived == false) {
		return false
	}
	if !(.Official == false) {
		return false
	}
	if !(.Masks == false) {
		return false
	}
	if !(.Animated == false) {
		return false
	}
	if !(.Videos == false) {
		return false
	}
	if !(.Emojis == false) {
		return false
	}
	if !(.TextColor == false) {
		return false
	}
	if !(.ChannelEmojiStatus == false) {
		return false
	}
	if !(.InstalledDate == 0) {
		return false
	}
	if !(.ID == 0) {
		return false
	}
	if !(.AccessHash == 0) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.ShortName == "") {
		return false
	}
	if !(.Thumbs == nil) {
		return false
	}
	if !(.ThumbDCID == 0) {
		return false
	}
	if !(.ThumbVersion == 0) {
		return false
	}
	if !(.ThumbDocumentID == 0) {
		return false
	}
	if !(.Count == 0) {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StickerSet from given interface.
func ( *StickerSet) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( int,  bool)
	() ( int64)
	() ( int64)
	() ( string)
	() ( string)
	() ( []PhotoSizeClass,  bool)
	() ( int,  bool)
	() ( int,  bool)
	() ( int64,  bool)
	() ( int)
	() ( int)
}) {
	.Archived = .()
	.Official = .()
	.Masks = .()
	.Animated = .()
	.Videos = .()
	.Emojis = .()
	.TextColor = .()
	.ChannelEmojiStatus = .()
	if ,  := .();  {
		.InstalledDate = 
	}

	.ID = .()
	.AccessHash = .()
	.Title = .()
	.ShortName = .()
	if ,  := .();  {
		.Thumbs = 
	}

	if ,  := .();  {
		.ThumbDCID = 
	}

	if ,  := .();  {
		.ThumbVersion = 
	}

	if ,  := .();  {
		.ThumbDocumentID = 
	}

	.Count = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StickerSet) () tdp.Type {
	 := tdp.Type{
		Name: "stickerSet",
		ID:   StickerSetTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Archived",
			SchemaName: "archived",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Official",
			SchemaName: "official",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Masks",
			SchemaName: "masks",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Animated",
			SchemaName: "animated",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Videos",
			SchemaName: "videos",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "Emojis",
			SchemaName: "emojis",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "TextColor",
			SchemaName: "text_color",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "ChannelEmojiStatus",
			SchemaName: "channel_emoji_status",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "InstalledDate",
			SchemaName: "installed_date",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "ShortName",
			SchemaName: "short_name",
		},
		{
			Name:       "Thumbs",
			SchemaName: "thumbs",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "ThumbDCID",
			SchemaName: "thumb_dc_id",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "ThumbVersion",
			SchemaName: "thumb_version",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "ThumbDocumentID",
			SchemaName: "thumb_document_id",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "Count",
			SchemaName: "count",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StickerSet) () {
	if !(.Archived == false) {
		.Flags.Set(1)
	}
	if !(.Official == false) {
		.Flags.Set(2)
	}
	if !(.Masks == false) {
		.Flags.Set(3)
	}
	if !(.Animated == false) {
		.Flags.Set(5)
	}
	if !(.Videos == false) {
		.Flags.Set(6)
	}
	if !(.Emojis == false) {
		.Flags.Set(7)
	}
	if !(.TextColor == false) {
		.Flags.Set(9)
	}
	if !(.ChannelEmojiStatus == false) {
		.Flags.Set(10)
	}
	if !(.InstalledDate == 0) {
		.Flags.Set(0)
	}
	if !(.Thumbs == nil) {
		.Flags.Set(4)
	}
	if !(.ThumbDCID == 0) {
		.Flags.Set(4)
	}
	if !(.ThumbVersion == 0) {
		.Flags.Set(4)
	}
	if !(.ThumbDocumentID == 0) {
		.Flags.Set(8)
	}
}

// Encode implements bin.Encoder.
func ( *StickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickerSet#2dd14edc as nil")
	}
	.PutID(StickerSetTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickerSet#2dd14edc as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode stickerSet#2dd14edc: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutInt(.InstalledDate)
	}
	.PutLong(.ID)
	.PutLong(.AccessHash)
	.PutString(.Title)
	.PutString(.ShortName)
	if .Flags.Has(4) {
		.PutVectorHeader(len(.Thumbs))
		for ,  := range .Thumbs {
			if  == nil {
				return fmt.Errorf("unable to encode stickerSet#2dd14edc: field thumbs element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode stickerSet#2dd14edc: field thumbs element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(4) {
		.PutInt(.ThumbDCID)
	}
	if .Flags.Has(4) {
		.PutInt(.ThumbVersion)
	}
	if .Flags.Has(8) {
		.PutLong(.ThumbDocumentID)
	}
	.PutInt(.Count)
	.PutInt(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StickerSet) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickerSet#2dd14edc to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field flags: %w", )
		}
	}
	.Archived = .Flags.Has(1)
	.Official = .Flags.Has(2)
	.Masks = .Flags.Has(3)
	.Animated = .Flags.Has(5)
	.Videos = .Flags.Has(6)
	.Emojis = .Flags.Has(7)
	.TextColor = .Flags.Has(9)
	.ChannelEmojiStatus = .Flags.Has(10)
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field installed_date: %w", )
		}
		.InstalledDate = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field access_hash: %w", )
		}
		.AccessHash = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field short_name: %w", )
		}
		.ShortName = 
	}
	if .Flags.Has(4) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field thumbs: %w", )
		}

		if  > 0 {
			.Thumbs = make([]PhotoSizeClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodePhotoSize()
			if  != nil {
				return fmt.Errorf("unable to decode stickerSet#2dd14edc: field thumbs: %w", )
			}
			.Thumbs = append(.Thumbs, )
		}
	}
	if .Flags.Has(4) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field thumb_dc_id: %w", )
		}
		.ThumbDCID = 
	}
	if .Flags.Has(4) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field thumb_version: %w", )
		}
		.ThumbVersion = 
	}
	if .Flags.Has(8) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field thumb_document_id: %w", )
		}
		.ThumbDocumentID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field count: %w", )
		}
		.Count = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickerSet#2dd14edc: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// SetArchived sets value of Archived conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(1)
		.Archived = true
	} else {
		.Flags.Unset(1)
		.Archived = false
	}
}

// GetArchived returns value of Archived conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetOfficial sets value of Official conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(2)
		.Official = true
	} else {
		.Flags.Unset(2)
		.Official = false
	}
}

// GetOfficial returns value of Official conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetMasks sets value of Masks conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(3)
		.Masks = true
	} else {
		.Flags.Unset(3)
		.Masks = false
	}
}

// GetMasks returns value of Masks conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetAnimated sets value of Animated conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(5)
		.Animated = true
	} else {
		.Flags.Unset(5)
		.Animated = false
	}
}

// GetAnimated returns value of Animated conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetVideos sets value of Videos conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(6)
		.Videos = true
	} else {
		.Flags.Unset(6)
		.Videos = false
	}
}

// GetVideos returns value of Videos conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetEmojis sets value of Emojis conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(7)
		.Emojis = true
	} else {
		.Flags.Unset(7)
		.Emojis = false
	}
}

// GetEmojis returns value of Emojis conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(7)
}

// SetTextColor sets value of TextColor conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(9)
		.TextColor = true
	} else {
		.Flags.Unset(9)
		.TextColor = false
	}
}

// GetTextColor returns value of TextColor conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetChannelEmojiStatus sets value of ChannelEmojiStatus conditional field.
func ( *StickerSet) ( bool) {
	if  {
		.Flags.Set(10)
		.ChannelEmojiStatus = true
	} else {
		.Flags.Unset(10)
		.ChannelEmojiStatus = false
	}
}

// GetChannelEmojiStatus returns value of ChannelEmojiStatus conditional field.
func ( *StickerSet) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetInstalledDate sets value of InstalledDate conditional field.
func ( *StickerSet) ( int) {
	.Flags.Set(0)
	.InstalledDate = 
}

// GetInstalledDate returns value of InstalledDate conditional field and
// boolean which is true if field was set.
func ( *StickerSet) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .InstalledDate, true
}

// GetID returns value of ID field.
func ( *StickerSet) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

// GetAccessHash returns value of AccessHash field.
func ( *StickerSet) () ( int64) {
	if  == nil {
		return
	}
	return .AccessHash
}

// GetTitle returns value of Title field.
func ( *StickerSet) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetShortName returns value of ShortName field.
func ( *StickerSet) () ( string) {
	if  == nil {
		return
	}
	return .ShortName
}

// SetThumbs sets value of Thumbs conditional field.
func ( *StickerSet) ( []PhotoSizeClass) {
	.Flags.Set(4)
	.Thumbs = 
}

// GetThumbs returns value of Thumbs conditional field and
// boolean which is true if field was set.
func ( *StickerSet) () ( []PhotoSizeClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .Thumbs, true
}

// SetThumbDCID sets value of ThumbDCID conditional field.
func ( *StickerSet) ( int) {
	.Flags.Set(4)
	.ThumbDCID = 
}

// GetThumbDCID returns value of ThumbDCID conditional field and
// boolean which is true if field was set.
func ( *StickerSet) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .ThumbDCID, true
}

// SetThumbVersion sets value of ThumbVersion conditional field.
func ( *StickerSet) ( int) {
	.Flags.Set(4)
	.ThumbVersion = 
}

// GetThumbVersion returns value of ThumbVersion conditional field and
// boolean which is true if field was set.
func ( *StickerSet) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .ThumbVersion, true
}

// SetThumbDocumentID sets value of ThumbDocumentID conditional field.
func ( *StickerSet) ( int64) {
	.Flags.Set(8)
	.ThumbDocumentID = 
}

// GetThumbDocumentID returns value of ThumbDocumentID conditional field and
// boolean which is true if field was set.
func ( *StickerSet) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(8) {
		return , false
	}
	return .ThumbDocumentID, true
}

// GetCount returns value of Count field.
func ( *StickerSet) () ( int) {
	if  == nil {
		return
	}
	return .Count
}

// GetHash returns value of Hash field.
func ( *StickerSet) () ( int) {
	if  == nil {
		return
	}
	return .Hash
}

// MapThumbs returns field Thumbs wrapped in PhotoSizeClassArray helper.
func ( *StickerSet) () ( PhotoSizeClassArray,  bool) {
	if !.Flags.Has(4) {
		return , false
	}
	return PhotoSizeClassArray(.Thumbs), true
}