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

// InputTheme represents TL type `inputTheme#3c5693e9`.
// Theme
//
// See https://core.telegram.org/constructor/inputTheme for reference.
type InputTheme struct {
	// ID
	ID int64
	// Access hash
	AccessHash int64
}

// InputThemeTypeID is TL type id of InputTheme.
const InputThemeTypeID = 0x3c5693e9

// construct implements constructor of InputThemeClass.
func ( InputTheme) () InputThemeClass { return & }

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

	_ InputThemeClass = &InputTheme{}
)

func ( *InputTheme) () bool {
	if  == nil {
		return true
	}
	if !(.ID == 0) {
		return false
	}
	if !(.AccessHash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputTheme from given interface.
func ( *InputTheme) ( interface {
	() ( int64)
	() ( int64)
}) {
	.ID = .()
	.AccessHash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputTheme) () tdp.Type {
	 := tdp.Type{
		Name: "inputTheme",
		ID:   InputThemeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputTheme) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputTheme#3c5693e9 as nil")
	}
	.PutID(InputThemeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputTheme) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputTheme#3c5693e9 as nil")
	}
	.PutLong(.ID)
	.PutLong(.AccessHash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputTheme) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputTheme#3c5693e9 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputTheme#3c5693e9: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputTheme#3c5693e9: field access_hash: %w", )
		}
		.AccessHash = 
	}
	return nil
}

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

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

// InputThemeSlug represents TL type `inputThemeSlug#f5890df1`.
// Theme by theme ID
//
// See https://core.telegram.org/constructor/inputThemeSlug for reference.
type InputThemeSlug struct {
	// Unique theme ID obtained from a theme deep link »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/links#theme-links
	Slug string
}

// InputThemeSlugTypeID is TL type id of InputThemeSlug.
const InputThemeSlugTypeID = 0xf5890df1

// construct implements constructor of InputThemeClass.
func ( InputThemeSlug) () InputThemeClass { return & }

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

	_ InputThemeClass = &InputThemeSlug{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputThemeSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputThemeSlug#f5890df1 as nil")
	}
	.PutID(InputThemeSlugTypeID)
	return .EncodeBare()
}

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

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

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

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

// InputThemeClassName is schema name of InputThemeClass.
const InputThemeClassName = "InputTheme"

// InputThemeClass represents InputTheme generic type.
//
// See https://core.telegram.org/type/InputTheme for reference.
//
// Example:
//
//	g, err := tg.DecodeInputTheme(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputTheme: // inputTheme#3c5693e9
//	case *tg.InputThemeSlug: // inputThemeSlug#f5890df1
//	default: panic(v)
//	}
type InputThemeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputThemeClass

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

// DecodeInputTheme implements binary de-serialization for InputThemeClass.
func ( *bin.Buffer) (InputThemeClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputThemeTypeID:
		// Decoding inputTheme#3c5693e9.
		 := InputTheme{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputThemeClass: %w", )
		}
		return &, nil
	case InputThemeSlugTypeID:
		// Decoding inputThemeSlug#f5890df1.
		 := InputThemeSlug{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputThemeClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputThemeClass: %w", bin.NewUnexpectedID())
	}
}

// InputTheme boxes the InputThemeClass providing a helper.
type InputThemeBox struct {
	InputTheme InputThemeClass
}

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

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