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

// HelpAppConfigNotModified represents TL type `help.appConfigNotModified#7cde641d`.
// The client configuration parameters haven't changed
//
// See https://core.telegram.org/constructor/help.appConfigNotModified for reference.
type HelpAppConfigNotModified struct {
}

// HelpAppConfigNotModifiedTypeID is TL type id of HelpAppConfigNotModified.
const HelpAppConfigNotModifiedTypeID = 0x7cde641d

// construct implements constructor of HelpAppConfigClass.
func ( HelpAppConfigNotModified) () HelpAppConfigClass { return & }

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

	_ HelpAppConfigClass = &HelpAppConfigNotModified{}
)

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

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*HelpAppConfigNotModified) () string {
	return "help.appConfigNotModified"
}

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

// Encode implements bin.Encoder.
func ( *HelpAppConfigNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.appConfigNotModified#7cde641d as nil")
	}
	.PutID(HelpAppConfigNotModifiedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpAppConfigNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.appConfigNotModified#7cde641d as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *HelpAppConfigNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.appConfigNotModified#7cde641d to nil")
	}
	if  := .ConsumeID(HelpAppConfigNotModifiedTypeID);  != nil {
		return fmt.Errorf("unable to decode help.appConfigNotModified#7cde641d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *HelpAppConfigNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.appConfigNotModified#7cde641d to nil")
	}
	return nil
}

// HelpAppConfig represents TL type `help.appConfig#dd18782e`.
// Contains various client configuration parameters¹
//
// Links:
//  1. https://core.telegram.org/api/config#client-configuration
//
// See https://core.telegram.org/constructor/help.appConfig for reference.
type HelpAppConfig struct {
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int
	// Client configuration parameters¹
	//
	// Links:
	//  1) https://core.telegram.org/api/config#client-configuration
	Config JSONValueClass
}

// HelpAppConfigTypeID is TL type id of HelpAppConfig.
const HelpAppConfigTypeID = 0xdd18782e

// construct implements constructor of HelpAppConfigClass.
func ( HelpAppConfig) () HelpAppConfigClass { return & }

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

	_ HelpAppConfigClass = &HelpAppConfig{}
)

func ( *HelpAppConfig) () bool {
	if  == nil {
		return true
	}
	if !(.Hash == 0) {
		return false
	}
	if !(.Config == nil) {
		return false
	}

	return true
}

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

// FillFrom fills HelpAppConfig from given interface.
func ( *HelpAppConfig) ( interface {
	() ( int)
	() ( JSONValueClass)
}) {
	.Hash = .()
	.Config = .()
}

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

// TypeName returns name of type in TL schema.
func (*HelpAppConfig) () string {
	return "help.appConfig"
}

// TypeInfo returns info about TL type.
func ( *HelpAppConfig) () tdp.Type {
	 := tdp.Type{
		Name: "help.appConfig",
		ID:   HelpAppConfigTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "Config",
			SchemaName: "config",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpAppConfig) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.appConfig#dd18782e as nil")
	}
	.PutID(HelpAppConfigTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpAppConfig) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.appConfig#dd18782e as nil")
	}
	.PutInt(.Hash)
	if .Config == nil {
		return fmt.Errorf("unable to encode help.appConfig#dd18782e: field config is nil")
	}
	if  := .Config.Encode();  != nil {
		return fmt.Errorf("unable to encode help.appConfig#dd18782e: field config: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *HelpAppConfig) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.appConfig#dd18782e to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode help.appConfig#dd18782e: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := DecodeJSONValue()
		if  != nil {
			return fmt.Errorf("unable to decode help.appConfig#dd18782e: field config: %w", )
		}
		.Config = 
	}
	return nil
}

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

// GetConfig returns value of Config field.
func ( *HelpAppConfig) () ( JSONValueClass) {
	if  == nil {
		return
	}
	return .Config
}

// HelpAppConfigClassName is schema name of HelpAppConfigClass.
const HelpAppConfigClassName = "help.AppConfig"

// HelpAppConfigClass represents help.AppConfig generic type.
//
// See https://core.telegram.org/type/help.AppConfig for reference.
//
// Example:
//
//	g, err := tg.DecodeHelpAppConfig(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.HelpAppConfigNotModified: // help.appConfigNotModified#7cde641d
//	case *tg.HelpAppConfig: // help.appConfig#dd18782e
//	default: panic(v)
//	}
type HelpAppConfigClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() HelpAppConfigClass

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

	// AsModified tries to map HelpAppConfigClass to HelpAppConfig.
	AsModified() (*HelpAppConfig, bool)
}

// AsModified tries to map HelpAppConfigNotModified to HelpAppConfig.
func ( *HelpAppConfigNotModified) () (*HelpAppConfig, bool) {
	return nil, false
}

// AsModified tries to map HelpAppConfig to HelpAppConfig.
func ( *HelpAppConfig) () (*HelpAppConfig, bool) {
	return , true
}

// DecodeHelpAppConfig implements binary de-serialization for HelpAppConfigClass.
func ( *bin.Buffer) (HelpAppConfigClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case HelpAppConfigNotModifiedTypeID:
		// Decoding help.appConfigNotModified#7cde641d.
		 := HelpAppConfigNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode HelpAppConfigClass: %w", )
		}
		return &, nil
	case HelpAppConfigTypeID:
		// Decoding help.appConfig#dd18782e.
		 := HelpAppConfig{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode HelpAppConfigClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode HelpAppConfigClass: %w", bin.NewUnexpectedID())
	}
}

// HelpAppConfig boxes the HelpAppConfigClass providing a helper.
type HelpAppConfigBox struct {
	AppConfig HelpAppConfigClass
}

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

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