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

// InputChatThemeEmpty represents TL type `inputChatThemeEmpty#83268483`.
// Remove any currently configured theme.
//
// See https://core.telegram.org/constructor/inputChatThemeEmpty for reference.
type InputChatThemeEmpty struct {
}

// InputChatThemeEmptyTypeID is TL type id of InputChatThemeEmpty.
const InputChatThemeEmptyTypeID = 0x83268483

// construct implements constructor of InputChatThemeClass.
func ( InputChatThemeEmpty) () InputChatThemeClass { return & }

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

	_ InputChatThemeClass = &InputChatThemeEmpty{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputChatThemeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatThemeEmpty#83268483 as nil")
	}
	.PutID(InputChatThemeEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputChatThemeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatThemeEmpty#83268483 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputChatThemeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputChatThemeEmpty#83268483 to nil")
	}
	return nil
}

// InputChatTheme represents TL type `inputChatTheme#c93de95c`.
// Set an emoji-based chat theme, returned by account.getChatThemes¹.
//
// Links:
//  1. https://core.telegram.org/method/account.getChatThemes
//
// See https://core.telegram.org/constructor/inputChatTheme for reference.
type InputChatTheme struct {
	// The emoji.
	Emoticon string
}

// InputChatThemeTypeID is TL type id of InputChatTheme.
const InputChatThemeTypeID = 0xc93de95c

// construct implements constructor of InputChatThemeClass.
func ( InputChatTheme) () InputChatThemeClass { return & }

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

	_ InputChatThemeClass = &InputChatTheme{}
)

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

	return true
}

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

// FillFrom fills InputChatTheme from given interface.
func ( *InputChatTheme) ( interface {
	() ( string)
}) {
	.Emoticon = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *InputChatTheme) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatTheme#c93de95c as nil")
	}
	.PutID(InputChatThemeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputChatTheme) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatTheme#c93de95c as nil")
	}
	.PutString(.Emoticon)
	return nil
}

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

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

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

// InputChatThemeUniqueGift represents TL type `inputChatThemeUniqueGift#87e5dfe4`.
// Set a theme based on an owned collectible gift »¹, returned by account
// getUniqueGiftChatThemes².
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://core.telegram.org/method/account.getUniqueGiftChatThemes
//
// See https://core.telegram.org/constructor/inputChatThemeUniqueGift for reference.
type InputChatThemeUniqueGift struct {
	// The slug from starGiftUnique¹.slug.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/starGiftUnique
	Slug string
}

// InputChatThemeUniqueGiftTypeID is TL type id of InputChatThemeUniqueGift.
const InputChatThemeUniqueGiftTypeID = 0x87e5dfe4

// construct implements constructor of InputChatThemeClass.
func ( InputChatThemeUniqueGift) () InputChatThemeClass { return & }

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

	_ InputChatThemeClass = &InputChatThemeUniqueGift{}
)

func ( *InputChatThemeUniqueGift) () bool {
	if  == nil {
		return true
	}
	if !(.Slug == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputChatThemeUniqueGift from given interface.
func ( *InputChatThemeUniqueGift) ( interface {
	() ( string)
}) {
	.Slug = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputChatThemeUniqueGift) () tdp.Type {
	 := tdp.Type{
		Name: "inputChatThemeUniqueGift",
		ID:   InputChatThemeUniqueGiftTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Slug",
			SchemaName: "slug",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputChatThemeUniqueGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatThemeUniqueGift#87e5dfe4 as nil")
	}
	.PutID(InputChatThemeUniqueGiftTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputChatThemeUniqueGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputChatThemeUniqueGift#87e5dfe4 as nil")
	}
	.PutString(.Slug)
	return nil
}

// Decode implements bin.Decoder.
func ( *InputChatThemeUniqueGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputChatThemeUniqueGift#87e5dfe4 to nil")
	}
	if  := .ConsumeID(InputChatThemeUniqueGiftTypeID);  != nil {
		return fmt.Errorf("unable to decode inputChatThemeUniqueGift#87e5dfe4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputChatThemeUniqueGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputChatThemeUniqueGift#87e5dfe4 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputChatThemeUniqueGift#87e5dfe4: field slug: %w", )
		}
		.Slug = 
	}
	return nil
}

// GetSlug returns value of Slug field.
func ( *InputChatThemeUniqueGift) () ( string) {
	if  == nil {
		return
	}
	return .Slug
}

// InputChatThemeClassName is schema name of InputChatThemeClass.
const InputChatThemeClassName = "InputChatTheme"

// InputChatThemeClass represents InputChatTheme generic type.
//
// See https://core.telegram.org/type/InputChatTheme for reference.
//
// Constructors:
//   - [InputChatThemeEmpty]
//   - [InputChatTheme]
//   - [InputChatThemeUniqueGift]
//
// Example:
//
//	g, err := tg.DecodeInputChatTheme(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputChatThemeEmpty: // inputChatThemeEmpty#83268483
//	case *tg.InputChatTheme: // inputChatTheme#c93de95c
//	case *tg.InputChatThemeUniqueGift: // inputChatThemeUniqueGift#87e5dfe4
//	default: panic(v)
//	}
type InputChatThemeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputChatThemeClass

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

// DecodeInputChatTheme implements binary de-serialization for InputChatThemeClass.
func ( *bin.Buffer) (InputChatThemeClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputChatThemeEmptyTypeID:
		// Decoding inputChatThemeEmpty#83268483.
		 := InputChatThemeEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputChatThemeClass: %w", )
		}
		return &, nil
	case InputChatThemeTypeID:
		// Decoding inputChatTheme#c93de95c.
		 := InputChatTheme{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputChatThemeClass: %w", )
		}
		return &, nil
	case InputChatThemeUniqueGiftTypeID:
		// Decoding inputChatThemeUniqueGift#87e5dfe4.
		 := InputChatThemeUniqueGift{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputChatThemeClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputChatThemeClass: %w", bin.NewUnexpectedID())
	}
}

// InputChatTheme boxes the InputChatThemeClass providing a helper.
type InputChatThemeBox struct {
	InputChatTheme InputChatThemeClass
}

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

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