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

// BaseThemeClassic represents TL type `baseThemeClassic#c3a12462`.
// Classic theme
//
// See https://core.telegram.org/constructor/baseThemeClassic for reference.
type BaseThemeClassic struct {
}

// BaseThemeClassicTypeID is TL type id of BaseThemeClassic.
const BaseThemeClassicTypeID = 0xc3a12462

// construct implements constructor of BaseThemeClass.
func ( BaseThemeClassic) () BaseThemeClass { return & }

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

	_ BaseThemeClass = &BaseThemeClassic{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BaseThemeClassic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeClassic#c3a12462 as nil")
	}
	.PutID(BaseThemeClassicTypeID)
	return .EncodeBare()
}

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

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

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

// BaseThemeDay represents TL type `baseThemeDay#fbd81688`.
// Day theme
//
// See https://core.telegram.org/constructor/baseThemeDay for reference.
type BaseThemeDay struct {
}

// BaseThemeDayTypeID is TL type id of BaseThemeDay.
const BaseThemeDayTypeID = 0xfbd81688

// construct implements constructor of BaseThemeClass.
func ( BaseThemeDay) () BaseThemeClass { return & }

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

	_ BaseThemeClass = &BaseThemeDay{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BaseThemeDay) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeDay#fbd81688 as nil")
	}
	.PutID(BaseThemeDayTypeID)
	return .EncodeBare()
}

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

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

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

// BaseThemeNight represents TL type `baseThemeNight#b7b31ea8`.
// Night theme
//
// See https://core.telegram.org/constructor/baseThemeNight for reference.
type BaseThemeNight struct {
}

// BaseThemeNightTypeID is TL type id of BaseThemeNight.
const BaseThemeNightTypeID = 0xb7b31ea8

// construct implements constructor of BaseThemeClass.
func ( BaseThemeNight) () BaseThemeClass { return & }

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

	_ BaseThemeClass = &BaseThemeNight{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BaseThemeNight) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeNight#b7b31ea8 as nil")
	}
	.PutID(BaseThemeNightTypeID)
	return .EncodeBare()
}

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

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

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

// BaseThemeTinted represents TL type `baseThemeTinted#6d5f77ee`.
// Tinted theme
//
// See https://core.telegram.org/constructor/baseThemeTinted for reference.
type BaseThemeTinted struct {
}

// BaseThemeTintedTypeID is TL type id of BaseThemeTinted.
const BaseThemeTintedTypeID = 0x6d5f77ee

// construct implements constructor of BaseThemeClass.
func ( BaseThemeTinted) () BaseThemeClass { return & }

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

	_ BaseThemeClass = &BaseThemeTinted{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BaseThemeTinted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeTinted#6d5f77ee as nil")
	}
	.PutID(BaseThemeTintedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BaseThemeTinted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeTinted#6d5f77ee as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BaseThemeTinted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode baseThemeTinted#6d5f77ee to nil")
	}
	return nil
}

// BaseThemeArctic represents TL type `baseThemeArctic#5b11125a`.
// Arctic theme
//
// See https://core.telegram.org/constructor/baseThemeArctic for reference.
type BaseThemeArctic struct {
}

// BaseThemeArcticTypeID is TL type id of BaseThemeArctic.
const BaseThemeArcticTypeID = 0x5b11125a

// construct implements constructor of BaseThemeClass.
func ( BaseThemeArctic) () BaseThemeClass { return & }

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

	_ BaseThemeClass = &BaseThemeArctic{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BaseThemeArctic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeArctic#5b11125a as nil")
	}
	.PutID(BaseThemeArcticTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BaseThemeArctic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode baseThemeArctic#5b11125a as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BaseThemeArctic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode baseThemeArctic#5b11125a to nil")
	}
	return nil
}

// BaseThemeClassName is schema name of BaseThemeClass.
const BaseThemeClassName = "BaseTheme"

// BaseThemeClass represents BaseTheme generic type.
//
// See https://core.telegram.org/type/BaseTheme for reference.
//
// Example:
//
//	g, err := tg.DecodeBaseTheme(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.BaseThemeClassic: // baseThemeClassic#c3a12462
//	case *tg.BaseThemeDay: // baseThemeDay#fbd81688
//	case *tg.BaseThemeNight: // baseThemeNight#b7b31ea8
//	case *tg.BaseThemeTinted: // baseThemeTinted#6d5f77ee
//	case *tg.BaseThemeArctic: // baseThemeArctic#5b11125a
//	default: panic(v)
//	}
type BaseThemeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() BaseThemeClass

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

// DecodeBaseTheme implements binary de-serialization for BaseThemeClass.
func ( *bin.Buffer) (BaseThemeClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case BaseThemeClassicTypeID:
		// Decoding baseThemeClassic#c3a12462.
		 := BaseThemeClassic{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", )
		}
		return &, nil
	case BaseThemeDayTypeID:
		// Decoding baseThemeDay#fbd81688.
		 := BaseThemeDay{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", )
		}
		return &, nil
	case BaseThemeNightTypeID:
		// Decoding baseThemeNight#b7b31ea8.
		 := BaseThemeNight{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", )
		}
		return &, nil
	case BaseThemeTintedTypeID:
		// Decoding baseThemeTinted#6d5f77ee.
		 := BaseThemeTinted{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", )
		}
		return &, nil
	case BaseThemeArcticTypeID:
		// Decoding baseThemeArctic#5b11125a.
		 := BaseThemeArctic{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode BaseThemeClass: %w", bin.NewUnexpectedID())
	}
}

// BaseTheme boxes the BaseThemeClass providing a helper.
type BaseThemeBox struct {
	BaseTheme BaseThemeClass
}

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

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