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

// InputNotifyPeer represents TL type `inputNotifyPeer#b8bc5b0c`.
// Notifications generated by a certain user or group.
//
// See https://core.telegram.org/constructor/inputNotifyPeer for reference.
type InputNotifyPeer struct {
	// User or group
	Peer InputPeerClass
}

// InputNotifyPeerTypeID is TL type id of InputNotifyPeer.
const InputNotifyPeerTypeID = 0xb8bc5b0c

// construct implements constructor of InputNotifyPeerClass.
func ( InputNotifyPeer) () InputNotifyPeerClass { return & }

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

	_ InputNotifyPeerClass = &InputNotifyPeer{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputNotifyPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyPeer#b8bc5b0c as nil")
	}
	.PutID(InputNotifyPeerTypeID)
	return .EncodeBare()
}

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

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

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

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

// InputNotifyUsers represents TL type `inputNotifyUsers#193b4417`.
// Notifications generated by all users.
//
// See https://core.telegram.org/constructor/inputNotifyUsers for reference.
type InputNotifyUsers struct {
}

// InputNotifyUsersTypeID is TL type id of InputNotifyUsers.
const InputNotifyUsersTypeID = 0x193b4417

// construct implements constructor of InputNotifyPeerClass.
func ( InputNotifyUsers) () InputNotifyPeerClass { return & }

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

	_ InputNotifyPeerClass = &InputNotifyUsers{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputNotifyUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyUsers#193b4417 as nil")
	}
	.PutID(InputNotifyUsersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputNotifyUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyUsers#193b4417 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputNotifyUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputNotifyUsers#193b4417 to nil")
	}
	return nil
}

// InputNotifyChats represents TL type `inputNotifyChats#4a95e84e`.
// Notifications generated by all groups.
//
// See https://core.telegram.org/constructor/inputNotifyChats for reference.
type InputNotifyChats struct {
}

// InputNotifyChatsTypeID is TL type id of InputNotifyChats.
const InputNotifyChatsTypeID = 0x4a95e84e

// construct implements constructor of InputNotifyPeerClass.
func ( InputNotifyChats) () InputNotifyPeerClass { return & }

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

	_ InputNotifyPeerClass = &InputNotifyChats{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputNotifyChats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyChats#4a95e84e as nil")
	}
	.PutID(InputNotifyChatsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputNotifyChats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyChats#4a95e84e as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputNotifyChats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputNotifyChats#4a95e84e to nil")
	}
	return nil
}

// InputNotifyBroadcasts represents TL type `inputNotifyBroadcasts#b1db7c7e`.
// All channels¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/inputNotifyBroadcasts for reference.
type InputNotifyBroadcasts struct {
}

// InputNotifyBroadcastsTypeID is TL type id of InputNotifyBroadcasts.
const InputNotifyBroadcastsTypeID = 0xb1db7c7e

// construct implements constructor of InputNotifyPeerClass.
func ( InputNotifyBroadcasts) () InputNotifyPeerClass { return & }

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

	_ InputNotifyPeerClass = &InputNotifyBroadcasts{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputNotifyBroadcasts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyBroadcasts#b1db7c7e as nil")
	}
	.PutID(InputNotifyBroadcastsTypeID)
	return .EncodeBare()
}

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

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

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

// InputNotifyForumTopic represents TL type `inputNotifyForumTopic#5c467992`.
// Notifications generated by a topic¹ in a forum².
//
// Links:
//  1. https://core.telegram.org/api/forum#forum-topics
//  2. https://core.telegram.org/api/forum
//
// See https://core.telegram.org/constructor/inputNotifyForumTopic for reference.
type InputNotifyForumTopic struct {
	// Forum ID
	Peer InputPeerClass
	// Topic ID¹
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#forum-topics
	TopMsgID int
}

// InputNotifyForumTopicTypeID is TL type id of InputNotifyForumTopic.
const InputNotifyForumTopicTypeID = 0x5c467992

// construct implements constructor of InputNotifyPeerClass.
func ( InputNotifyForumTopic) () InputNotifyPeerClass { return & }

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

	_ InputNotifyPeerClass = &InputNotifyForumTopic{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputNotifyForumTopic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputNotifyForumTopic#5c467992 as nil")
	}
	.PutID(InputNotifyForumTopicTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *InputNotifyForumTopic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputNotifyForumTopic#5c467992 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode inputNotifyForumTopic#5c467992: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputNotifyForumTopic#5c467992: field top_msg_id: %w", )
		}
		.TopMsgID = 
	}
	return nil
}

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

// GetTopMsgID returns value of TopMsgID field.
func ( *InputNotifyForumTopic) () ( int) {
	if  == nil {
		return
	}
	return .TopMsgID
}

// InputNotifyPeerClassName is schema name of InputNotifyPeerClass.
const InputNotifyPeerClassName = "InputNotifyPeer"

// InputNotifyPeerClass represents InputNotifyPeer generic type.
//
// See https://core.telegram.org/type/InputNotifyPeer for reference.
//
// Example:
//
//	g, err := tg.DecodeInputNotifyPeer(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputNotifyPeer: // inputNotifyPeer#b8bc5b0c
//	case *tg.InputNotifyUsers: // inputNotifyUsers#193b4417
//	case *tg.InputNotifyChats: // inputNotifyChats#4a95e84e
//	case *tg.InputNotifyBroadcasts: // inputNotifyBroadcasts#b1db7c7e
//	case *tg.InputNotifyForumTopic: // inputNotifyForumTopic#5c467992
//	default: panic(v)
//	}
type InputNotifyPeerClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputNotifyPeerClass

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

// DecodeInputNotifyPeer implements binary de-serialization for InputNotifyPeerClass.
func ( *bin.Buffer) (InputNotifyPeerClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputNotifyPeerTypeID:
		// Decoding inputNotifyPeer#b8bc5b0c.
		 := InputNotifyPeer{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", )
		}
		return &, nil
	case InputNotifyUsersTypeID:
		// Decoding inputNotifyUsers#193b4417.
		 := InputNotifyUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", )
		}
		return &, nil
	case InputNotifyChatsTypeID:
		// Decoding inputNotifyChats#4a95e84e.
		 := InputNotifyChats{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", )
		}
		return &, nil
	case InputNotifyBroadcastsTypeID:
		// Decoding inputNotifyBroadcasts#b1db7c7e.
		 := InputNotifyBroadcasts{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", )
		}
		return &, nil
	case InputNotifyForumTopicTypeID:
		// Decoding inputNotifyForumTopic#5c467992.
		 := InputNotifyForumTopic{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputNotifyPeerClass: %w", bin.NewUnexpectedID())
	}
}

// InputNotifyPeer boxes the InputNotifyPeerClass providing a helper.
type InputNotifyPeerBox struct {
	InputNotifyPeer InputNotifyPeerClass
}

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

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