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

// BotCommandScopeDefault represents TL type `botCommandScopeDefault#2f6cb2ab`.
// The commands will be valid in all dialogs
//
// See https://core.telegram.org/constructor/botCommandScopeDefault for reference.
type BotCommandScopeDefault struct {
}

// BotCommandScopeDefaultTypeID is TL type id of BotCommandScopeDefault.
const BotCommandScopeDefaultTypeID = 0x2f6cb2ab

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopeDefault) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopeDefault{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BotCommandScopeDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeDefault#2f6cb2ab as nil")
	}
	.PutID(BotCommandScopeDefaultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotCommandScopeDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeDefault#2f6cb2ab as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotCommandScopeDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botCommandScopeDefault#2f6cb2ab to nil")
	}
	return nil
}

// BotCommandScopeUsers represents TL type `botCommandScopeUsers#3c4f04d8`.
// The specified bot commands will only be valid in all private chats with users.
//
// See https://core.telegram.org/constructor/botCommandScopeUsers for reference.
type BotCommandScopeUsers struct {
}

// BotCommandScopeUsersTypeID is TL type id of BotCommandScopeUsers.
const BotCommandScopeUsersTypeID = 0x3c4f04d8

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopeUsers) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopeUsers{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BotCommandScopeUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeUsers#3c4f04d8 as nil")
	}
	.PutID(BotCommandScopeUsersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotCommandScopeUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeUsers#3c4f04d8 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotCommandScopeUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botCommandScopeUsers#3c4f04d8 to nil")
	}
	return nil
}

// BotCommandScopeChats represents TL type `botCommandScopeChats#6fe1a881`.
// The specified bot commands will be valid in all groups and supergroups¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/botCommandScopeChats for reference.
type BotCommandScopeChats struct {
}

// BotCommandScopeChatsTypeID is TL type id of BotCommandScopeChats.
const BotCommandScopeChatsTypeID = 0x6fe1a881

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopeChats) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopeChats{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BotCommandScopeChats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeChats#6fe1a881 as nil")
	}
	.PutID(BotCommandScopeChatsTypeID)
	return .EncodeBare()
}

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

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

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

// BotCommandScopeChatAdmins represents TL type `botCommandScopeChatAdmins#b9aa606a`.
// The specified bot commands will be valid only for chat administrators, in all groups
// and supergroups¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/botCommandScopeChatAdmins for reference.
type BotCommandScopeChatAdmins struct {
}

// BotCommandScopeChatAdminsTypeID is TL type id of BotCommandScopeChatAdmins.
const BotCommandScopeChatAdminsTypeID = 0xb9aa606a

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopeChatAdmins) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopeChatAdmins{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BotCommandScopeChatAdmins) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopeChatAdmins#b9aa606a as nil")
	}
	.PutID(BotCommandScopeChatAdminsTypeID)
	return .EncodeBare()
}

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

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

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

// BotCommandScopePeer represents TL type `botCommandScopePeer#db9d897d`.
// The specified bot commands will be valid only in a specific dialog.
//
// See https://core.telegram.org/constructor/botCommandScopePeer for reference.
type BotCommandScopePeer struct {
	// The dialog
	Peer InputPeerClass
}

// BotCommandScopePeerTypeID is TL type id of BotCommandScopePeer.
const BotCommandScopePeerTypeID = 0xdb9d897d

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopePeer) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopePeer{}
)

func ( *BotCommandScopePeer) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotCommandScopePeer from given interface.
func ( *BotCommandScopePeer) ( interface {
	() ( InputPeerClass)
}) {
	.Peer = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotCommandScopePeer) () tdp.Type {
	 := tdp.Type{
		Name: "botCommandScopePeer",
		ID:   BotCommandScopePeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotCommandScopePeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeer#db9d897d as nil")
	}
	.PutID(BotCommandScopePeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotCommandScopePeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeer#db9d897d as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode botCommandScopePeer#db9d897d: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode botCommandScopePeer#db9d897d: field peer: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotCommandScopePeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botCommandScopePeer#db9d897d to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode botCommandScopePeer#db9d897d: field peer: %w", )
		}
		.Peer = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *BotCommandScopePeer) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// BotCommandScopePeerAdmins represents TL type `botCommandScopePeerAdmins#3fd863d1`.
// The specified bot commands will be valid for all admins of the specified group or
// supergroup¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/botCommandScopePeerAdmins for reference.
type BotCommandScopePeerAdmins struct {
	// The chat
	Peer InputPeerClass
}

// BotCommandScopePeerAdminsTypeID is TL type id of BotCommandScopePeerAdmins.
const BotCommandScopePeerAdminsTypeID = 0x3fd863d1

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopePeerAdmins) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopePeerAdmins{}
)

func ( *BotCommandScopePeerAdmins) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotCommandScopePeerAdmins from given interface.
func ( *BotCommandScopePeerAdmins) ( interface {
	() ( InputPeerClass)
}) {
	.Peer = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotCommandScopePeerAdmins) () tdp.Type {
	 := tdp.Type{
		Name: "botCommandScopePeerAdmins",
		ID:   BotCommandScopePeerAdminsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotCommandScopePeerAdmins) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeerAdmins#3fd863d1 as nil")
	}
	.PutID(BotCommandScopePeerAdminsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotCommandScopePeerAdmins) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeerAdmins#3fd863d1 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode botCommandScopePeerAdmins#3fd863d1: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode botCommandScopePeerAdmins#3fd863d1: field peer: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotCommandScopePeerAdmins) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botCommandScopePeerAdmins#3fd863d1 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode botCommandScopePeerAdmins#3fd863d1: field peer: %w", )
		}
		.Peer = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *BotCommandScopePeerAdmins) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// BotCommandScopePeerUser represents TL type `botCommandScopePeerUser#a1321f3`.
// The specified bot commands will be valid only for a specific user in the specified
// group or supergroup¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/botCommandScopePeerUser for reference.
type BotCommandScopePeerUser struct {
	// The chat
	Peer InputPeerClass
	// The user
	UserID InputUserClass
}

// BotCommandScopePeerUserTypeID is TL type id of BotCommandScopePeerUser.
const BotCommandScopePeerUserTypeID = 0xa1321f3

// construct implements constructor of BotCommandScopeClass.
func ( BotCommandScopePeerUser) () BotCommandScopeClass { return & }

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

	_ BotCommandScopeClass = &BotCommandScopePeerUser{}
)

func ( *BotCommandScopePeerUser) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.UserID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotCommandScopePeerUser from given interface.
func ( *BotCommandScopePeerUser) ( interface {
	() ( InputPeerClass)
	() ( InputUserClass)
}) {
	.Peer = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotCommandScopePeerUser) () tdp.Type {
	 := tdp.Type{
		Name: "botCommandScopePeerUser",
		ID:   BotCommandScopePeerUserTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotCommandScopePeerUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeerUser#a1321f3 as nil")
	}
	.PutID(BotCommandScopePeerUserTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotCommandScopePeerUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botCommandScopePeerUser#a1321f3 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode botCommandScopePeerUser#a1321f3: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode botCommandScopePeerUser#a1321f3: field peer: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode botCommandScopePeerUser#a1321f3: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode botCommandScopePeerUser#a1321f3: field user_id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotCommandScopePeerUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botCommandScopePeerUser#a1321f3 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode botCommandScopePeerUser#a1321f3: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode botCommandScopePeerUser#a1321f3: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *BotCommandScopePeerUser) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

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

// BotCommandScopeClassName is schema name of BotCommandScopeClass.
const BotCommandScopeClassName = "BotCommandScope"

// BotCommandScopeClass represents BotCommandScope generic type.
//
// See https://core.telegram.org/type/BotCommandScope for reference.
//
// Example:
//
//	g, err := tg.DecodeBotCommandScope(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.BotCommandScopeDefault: // botCommandScopeDefault#2f6cb2ab
//	case *tg.BotCommandScopeUsers: // botCommandScopeUsers#3c4f04d8
//	case *tg.BotCommandScopeChats: // botCommandScopeChats#6fe1a881
//	case *tg.BotCommandScopeChatAdmins: // botCommandScopeChatAdmins#b9aa606a
//	case *tg.BotCommandScopePeer: // botCommandScopePeer#db9d897d
//	case *tg.BotCommandScopePeerAdmins: // botCommandScopePeerAdmins#3fd863d1
//	case *tg.BotCommandScopePeerUser: // botCommandScopePeerUser#a1321f3
//	default: panic(v)
//	}
type BotCommandScopeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() BotCommandScopeClass

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

// DecodeBotCommandScope implements binary de-serialization for BotCommandScopeClass.
func ( *bin.Buffer) (BotCommandScopeClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case BotCommandScopeDefaultTypeID:
		// Decoding botCommandScopeDefault#2f6cb2ab.
		 := BotCommandScopeDefault{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopeUsersTypeID:
		// Decoding botCommandScopeUsers#3c4f04d8.
		 := BotCommandScopeUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopeChatsTypeID:
		// Decoding botCommandScopeChats#6fe1a881.
		 := BotCommandScopeChats{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopeChatAdminsTypeID:
		// Decoding botCommandScopeChatAdmins#b9aa606a.
		 := BotCommandScopeChatAdmins{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopePeerTypeID:
		// Decoding botCommandScopePeer#db9d897d.
		 := BotCommandScopePeer{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopePeerAdminsTypeID:
		// Decoding botCommandScopePeerAdmins#3fd863d1.
		 := BotCommandScopePeerAdmins{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	case BotCommandScopePeerUserTypeID:
		// Decoding botCommandScopePeerUser#a1321f3.
		 := BotCommandScopePeerUser{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", bin.NewUnexpectedID())
	}
}

// BotCommandScope boxes the BotCommandScopeClass providing a helper.
type BotCommandScopeBox struct {
	BotCommandScope BotCommandScopeClass
}

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

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