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

// StickersCreateStickerSetRequest represents TL type `stickers.createStickerSet#9021ab67`.
// Create a stickerset, bots only.
//
// See https://core.telegram.org/method/stickers.createStickerSet for reference.
type StickersCreateStickerSetRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this is a mask stickerset
	Masks bool
	// Whether this is an animated stickerset
	Animated bool
	// Whether this is a video stickerset
	Videos bool
	// Whether this is a custom emoji¹ stickerset.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	Emojis bool
	// Whether the color of TGS custom emojis contained in this set 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. For custom emoji
	// stickersets only.
	TextColor bool
	// Stickerset owner
	UserID InputUserClass
	// Stickerset name, 1-64 chars
	Title string
	// Short name of sticker set, to be used in sticker deep links »¹. Can contain only
	// english letters, digits and underscores. Must begin with a letter, can't contain
	// consecutive underscores and, if called by a bot, must end in "_by_<bot_username>".
	// <bot_username> is case insensitive. 1-64 characters.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#stickerset-links
	ShortName string
	// Thumbnail
	//
	// Use SetThumb and GetThumb helpers.
	Thumb InputDocumentClass
	// Stickers
	Stickers []InputStickerSetItem
	// Used when importing stickers using the sticker import SDKs¹, specifies the name of
	// the software that created the stickers
	//
	// Links:
	//  1) https://core.telegram.org/import-stickers
	//
	// Use SetSoftware and GetSoftware helpers.
	Software string
}

// StickersCreateStickerSetRequestTypeID is TL type id of StickersCreateStickerSetRequest.
const StickersCreateStickerSetRequestTypeID = 0x9021ab67

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

func ( *StickersCreateStickerSetRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		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 !(.UserID == nil) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.ShortName == "") {
		return false
	}
	if !(.Thumb == nil) {
		return false
	}
	if !(.Stickers == nil) {
		return false
	}
	if !(.Software == "") {
		return false
	}

	return true
}

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

// FillFrom fills StickersCreateStickerSetRequest from given interface.
func ( *StickersCreateStickerSetRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( InputUserClass)
	() ( string)
	() ( string)
	() ( InputDocumentClass,  bool)
	() ( []InputStickerSetItem)
	() ( string,  bool)
}) {
	.Masks = .()
	.Animated = .()
	.Videos = .()
	.Emojis = .()
	.TextColor = .()
	.UserID = .()
	.Title = .()
	.ShortName = .()
	if ,  := .();  {
		.Thumb = 
	}

	.Stickers = .()
	if ,  := .();  {
		.Software = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*StickersCreateStickerSetRequest) () string {
	return "stickers.createStickerSet"
}

// TypeInfo returns info about TL type.
func ( *StickersCreateStickerSetRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stickers.createStickerSet",
		ID:   StickersCreateStickerSetRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Masks",
			SchemaName: "masks",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Animated",
			SchemaName: "animated",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Videos",
			SchemaName: "videos",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Emojis",
			SchemaName: "emojis",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "TextColor",
			SchemaName: "text_color",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "ShortName",
			SchemaName: "short_name",
		},
		{
			Name:       "Thumb",
			SchemaName: "thumb",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Stickers",
			SchemaName: "stickers",
		},
		{
			Name:       "Software",
			SchemaName: "software",
			Null:       !.Flags.Has(3),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StickersCreateStickerSetRequest) () {
	if !(.Masks == false) {
		.Flags.Set(0)
	}
	if !(.Animated == false) {
		.Flags.Set(1)
	}
	if !(.Videos == false) {
		.Flags.Set(4)
	}
	if !(.Emojis == false) {
		.Flags.Set(5)
	}
	if !(.TextColor == false) {
		.Flags.Set(6)
	}
	if !(.Thumb == nil) {
		.Flags.Set(2)
	}
	if !(.Software == "") {
		.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func ( *StickersCreateStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.createStickerSet#9021ab67 as nil")
	}
	.PutID(StickersCreateStickerSetRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickersCreateStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.createStickerSet#9021ab67 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field flags: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field user_id: %w", )
	}
	.PutString(.Title)
	.PutString(.ShortName)
	if .Flags.Has(2) {
		if .Thumb == nil {
			return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field thumb is nil")
		}
		if  := .Thumb.Encode();  != nil {
			return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field thumb: %w", )
		}
	}
	.PutVectorHeader(len(.Stickers))
	for ,  := range .Stickers {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode stickers.createStickerSet#9021ab67: field stickers element with index %d: %w", , )
		}
	}
	if .Flags.Has(3) {
		.PutString(.Software)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *StickersCreateStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.createStickerSet#9021ab67 to nil")
	}
	if  := .ConsumeID(StickersCreateStickerSetRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StickersCreateStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.createStickerSet#9021ab67 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field flags: %w", )
		}
	}
	.Masks = .Flags.Has(0)
	.Animated = .Flags.Has(1)
	.Videos = .Flags.Has(4)
	.Emojis = .Flags.Has(5)
	.TextColor = .Flags.Has(6)
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field short_name: %w", )
		}
		.ShortName = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field thumb: %w", )
		}
		.Thumb = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field stickers: %w", )
		}

		if  > 0 {
			.Stickers = make([]InputStickerSetItem, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  InputStickerSetItem
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field stickers: %w", )
			}
			.Stickers = append(.Stickers, )
		}
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.createStickerSet#9021ab67: field software: %w", )
		}
		.Software = 
	}
	return nil
}

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

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

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

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

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

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

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

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

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

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

// GetUserID returns value of UserID field.
func ( *StickersCreateStickerSetRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

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

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

// SetThumb sets value of Thumb conditional field.
func ( *StickersCreateStickerSetRequest) ( InputDocumentClass) {
	.Flags.Set(2)
	.Thumb = 
}

// GetThumb returns value of Thumb conditional field and
// boolean which is true if field was set.
func ( *StickersCreateStickerSetRequest) () ( InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Thumb, true
}

// GetStickers returns value of Stickers field.
func ( *StickersCreateStickerSetRequest) () ( []InputStickerSetItem) {
	if  == nil {
		return
	}
	return .Stickers
}

// SetSoftware sets value of Software conditional field.
func ( *StickersCreateStickerSetRequest) ( string) {
	.Flags.Set(3)
	.Software = 
}

// GetSoftware returns value of Software conditional field and
// boolean which is true if field was set.
func ( *StickersCreateStickerSetRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .Software, true
}

// GetThumbAsNotEmpty returns mapped value of Thumb conditional field and
// boolean which is true if field was set.
func ( *StickersCreateStickerSetRequest) () (*InputDocument, bool) {
	if ,  := .GetThumb();  {
		return .AsNotEmpty()
	}
	return nil, false
}

// StickersCreateStickerSet invokes method stickers.createStickerSet#9021ab67 returning error if any.
// Create a stickerset, bots only.
//
// Possible errors:
//
//	400 PACK_SHORT_NAME_INVALID: Short pack name invalid.
//	400 PACK_SHORT_NAME_OCCUPIED: A stickerpack with this name already exists.
//	400 PACK_TITLE_INVALID: The stickerpack title is invalid.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 STICKERS_EMPTY: No sticker provided.
//	400 STICKER_EMOJI_INVALID: Sticker emoji invalid.
//	400 STICKER_FILE_INVALID: Sticker file invalid.
//	400 STICKER_GIF_DIMENSIONS: The specified video sticker has invalid dimensions.
//	400 STICKER_PNG_DIMENSIONS: Sticker png dimensions invalid.
//	400 STICKER_PNG_NOPNG: One of the specified stickers is not a valid PNG file.
//	400 STICKER_TGS_NODOC: You must send the animated sticker as a document.
//	400 STICKER_TGS_NOTGS: Invalid TGS sticker provided.
//	400 STICKER_THUMB_PNG_NOPNG: Incorrect stickerset thumb file provided, PNG / WEBP expected.
//	400 STICKER_THUMB_TGS_NOTGS: Incorrect stickerset TGS thumb file provided.
//	400 STICKER_VIDEO_BIG: The specified video sticker is too big.
//	400 STICKER_VIDEO_NODOC: You must send the video sticker as a document.
//	400 STICKER_VIDEO_NOWEBM: The specified video sticker is not in webm format.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/stickers.createStickerSet for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *StickersCreateStickerSetRequest) (MessagesStickerSetClass, error) {
	var  MessagesStickerSetBox

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