// Code generated by gotdgen, DO NOT EDIT.

package tdapi

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

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

// ChatEventMessageEdited represents TL type `chatEventMessageEdited#e64ff5f8`.
type ChatEventMessageEdited struct {
	// The original message before the edit
	OldMessage Message
	// The message after it was edited
	NewMessage Message
}

// ChatEventMessageEditedTypeID is TL type id of ChatEventMessageEdited.
const ChatEventMessageEditedTypeID = 0xe64ff5f8

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMessageEdited) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMessageEdited{}
)

func (c *ChatEventMessageEdited) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldMessage.Zero()) {
		return false
	}
	if !(c.NewMessage.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMessageEdited) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMessageEdited",
		ID:   ChatEventMessageEditedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldMessage",
			SchemaName: "old_message",
		},
		{
			Name:       "NewMessage",
			SchemaName: "new_message",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMessageEdited) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil")
	}
	b.PutID(ChatEventMessageEditedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMessageEdited) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil")
	}
	if err := c.OldMessage.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field old_message: %w", err)
	}
	if err := c.NewMessage.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field new_message: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMessageEdited) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil")
	}
	if err := b.ConsumeID(ChatEventMessageEditedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMessageEdited) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil")
	}
	{
		if err := c.OldMessage.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field old_message: %w", err)
		}
	}
	{
		if err := c.NewMessage.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field new_message: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMessageEdited) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMessageEdited")
	b.Comma()
	b.FieldStart("old_message")
	if err := c.OldMessage.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field old_message: %w", err)
	}
	b.Comma()
	b.FieldStart("new_message")
	if err := c.NewMessage.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field new_message: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMessageEdited) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMessageEdited"); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: %w", err)
			}
		case "old_message":
			if err := c.OldMessage.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field old_message: %w", err)
			}
		case "new_message":
			if err := c.NewMessage.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field new_message: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldMessage returns value of OldMessage field.
func (c *ChatEventMessageEdited) GetOldMessage() (value Message) {
	if c == nil {
		return
	}
	return c.OldMessage
}

// GetNewMessage returns value of NewMessage field.
func (c *ChatEventMessageEdited) GetNewMessage() (value Message) {
	if c == nil {
		return
	}
	return c.NewMessage
}

// ChatEventMessageDeleted represents TL type `chatEventMessageDeleted#37bfcd73`.
type ChatEventMessageDeleted struct {
	// Deleted message
	Message Message
	// True, if the message deletion can be reported via
	// reportSupergroupAntiSpamFalsePositive
	CanReportAntiSpamFalsePositive bool
}

// ChatEventMessageDeletedTypeID is TL type id of ChatEventMessageDeleted.
const ChatEventMessageDeletedTypeID = 0x37bfcd73

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMessageDeleted) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMessageDeleted{}
)

func (c *ChatEventMessageDeleted) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Message.Zero()) {
		return false
	}
	if !(c.CanReportAntiSpamFalsePositive == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMessageDeleted) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMessageDeleted",
		ID:   ChatEventMessageDeletedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "CanReportAntiSpamFalsePositive",
			SchemaName: "can_report_anti_spam_false_positive",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMessageDeleted) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil")
	}
	b.PutID(ChatEventMessageDeletedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMessageDeleted) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil")
	}
	if err := c.Message.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err)
	}
	b.PutBool(c.CanReportAntiSpamFalsePositive)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMessageDeleted) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil")
	}
	if err := b.ConsumeID(ChatEventMessageDeletedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMessageDeleted) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil")
	}
	{
		if err := c.Message.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err)
		}
		c.CanReportAntiSpamFalsePositive = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMessageDeleted) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMessageDeleted")
	b.Comma()
	b.FieldStart("message")
	if err := c.Message.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err)
	}
	b.Comma()
	b.FieldStart("can_report_anti_spam_false_positive")
	b.PutBool(c.CanReportAntiSpamFalsePositive)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMessageDeleted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMessageDeleted"); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err)
			}
		case "message":
			if err := c.Message.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err)
			}
		case "can_report_anti_spam_false_positive":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err)
			}
			c.CanReportAntiSpamFalsePositive = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMessage returns value of Message field.
func (c *ChatEventMessageDeleted) GetMessage() (value Message) {
	if c == nil {
		return
	}
	return c.Message
}

// GetCanReportAntiSpamFalsePositive returns value of CanReportAntiSpamFalsePositive field.
func (c *ChatEventMessageDeleted) GetCanReportAntiSpamFalsePositive() (value bool) {
	if c == nil {
		return
	}
	return c.CanReportAntiSpamFalsePositive
}

// ChatEventMessagePinned represents TL type `chatEventMessagePinned#1a26ad1a`.
type ChatEventMessagePinned struct {
	// Pinned message
	Message Message
}

// ChatEventMessagePinnedTypeID is TL type id of ChatEventMessagePinned.
const ChatEventMessagePinnedTypeID = 0x1a26ad1a

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMessagePinned) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMessagePinned{}
)

func (c *ChatEventMessagePinned) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Message.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMessagePinned) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMessagePinned",
		ID:   ChatEventMessagePinnedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMessagePinned) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil")
	}
	b.PutID(ChatEventMessagePinnedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMessagePinned) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil")
	}
	if err := c.Message.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessagePinned#1a26ad1a: field message: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMessagePinned) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil")
	}
	if err := b.ConsumeID(ChatEventMessagePinnedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMessagePinned) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil")
	}
	{
		if err := c.Message.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: field message: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMessagePinned) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMessagePinned")
	b.Comma()
	b.FieldStart("message")
	if err := c.Message.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessagePinned#1a26ad1a: field message: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMessagePinned) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMessagePinned"); err != nil {
				return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: %w", err)
			}
		case "message":
			if err := c.Message.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: field message: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMessage returns value of Message field.
func (c *ChatEventMessagePinned) GetMessage() (value Message) {
	if c == nil {
		return
	}
	return c.Message
}

// ChatEventMessageUnpinned represents TL type `chatEventMessageUnpinned#e9943b17`.
type ChatEventMessageUnpinned struct {
	// Unpinned message
	Message Message
}

// ChatEventMessageUnpinnedTypeID is TL type id of ChatEventMessageUnpinned.
const ChatEventMessageUnpinnedTypeID = 0xe9943b17

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMessageUnpinned) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMessageUnpinned{}
)

func (c *ChatEventMessageUnpinned) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Message.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMessageUnpinned) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMessageUnpinned",
		ID:   ChatEventMessageUnpinnedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMessageUnpinned) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil")
	}
	b.PutID(ChatEventMessageUnpinnedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMessageUnpinned) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil")
	}
	if err := c.Message.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageUnpinned#e9943b17: field message: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMessageUnpinned) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil")
	}
	if err := b.ConsumeID(ChatEventMessageUnpinnedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMessageUnpinned) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil")
	}
	{
		if err := c.Message.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: field message: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMessageUnpinned) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMessageUnpinned")
	b.Comma()
	b.FieldStart("message")
	if err := c.Message.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMessageUnpinned#e9943b17: field message: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMessageUnpinned) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMessageUnpinned"); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: %w", err)
			}
		case "message":
			if err := c.Message.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: field message: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMessage returns value of Message field.
func (c *ChatEventMessageUnpinned) GetMessage() (value Message) {
	if c == nil {
		return
	}
	return c.Message
}

// ChatEventPollStopped represents TL type `chatEventPollStopped#77cc8be5`.
type ChatEventPollStopped struct {
	// The message with the poll
	Message Message
}

// ChatEventPollStoppedTypeID is TL type id of ChatEventPollStopped.
const ChatEventPollStoppedTypeID = 0x77cc8be5

// construct implements constructor of ChatEventActionClass.
func (c ChatEventPollStopped) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventPollStopped{}
)

func (c *ChatEventPollStopped) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.Message.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventPollStopped) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventPollStopped",
		ID:   ChatEventPollStoppedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventPollStopped) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil")
	}
	b.PutID(ChatEventPollStoppedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventPollStopped) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil")
	}
	if err := c.Message.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventPollStopped) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil")
	}
	if err := b.ConsumeID(ChatEventPollStoppedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventPollStopped) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil")
	}
	{
		if err := c.Message.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventPollStopped) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventPollStopped")
	b.Comma()
	b.FieldStart("message")
	if err := c.Message.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventPollStopped) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventPollStopped"); err != nil {
				return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err)
			}
		case "message":
			if err := c.Message.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMessage returns value of Message field.
func (c *ChatEventPollStopped) GetMessage() (value Message) {
	if c == nil {
		return
	}
	return c.Message
}

// ChatEventMemberJoined represents TL type `chatEventMemberJoined#f1f70924`.
type ChatEventMemberJoined struct {
}

// ChatEventMemberJoinedTypeID is TL type id of ChatEventMemberJoined.
const ChatEventMemberJoinedTypeID = 0xf1f70924

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberJoined) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberJoined{}
)

func (c *ChatEventMemberJoined) Zero() bool {
	if c == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberJoined) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberJoined",
		ID:   ChatEventMemberJoinedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberJoined) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil")
	}
	b.PutID(ChatEventMemberJoinedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberJoined) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberJoined) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil")
	}
	if err := b.ConsumeID(ChatEventMemberJoinedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberJoined) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberJoined) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberJoined")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberJoined) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberJoined"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// ChatEventMemberJoinedByInviteLink represents TL type `chatEventMemberJoinedByInviteLink#a9d6dd7a`.
type ChatEventMemberJoinedByInviteLink struct {
	// Invite link used to join the chat
	InviteLink ChatInviteLink
	// True, if the user has joined the chat using an invite link for a chat folder
	ViaChatFolderInviteLink bool
}

// ChatEventMemberJoinedByInviteLinkTypeID is TL type id of ChatEventMemberJoinedByInviteLink.
const ChatEventMemberJoinedByInviteLinkTypeID = 0xa9d6dd7a

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberJoinedByInviteLink) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberJoinedByInviteLink{}
)

func (c *ChatEventMemberJoinedByInviteLink) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.InviteLink.Zero()) {
		return false
	}
	if !(c.ViaChatFolderInviteLink == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberJoinedByInviteLink) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberJoinedByInviteLink",
		ID:   ChatEventMemberJoinedByInviteLinkTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
		{
			Name:       "ViaChatFolderInviteLink",
			SchemaName: "via_chat_folder_invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberJoinedByInviteLink) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil")
	}
	b.PutID(ChatEventMemberJoinedByInviteLinkTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberJoinedByInviteLink) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil")
	}
	if err := c.InviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err)
	}
	b.PutBool(c.ViaChatFolderInviteLink)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberJoinedByInviteLink) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil")
	}
	if err := b.ConsumeID(ChatEventMemberJoinedByInviteLinkTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberJoinedByInviteLink) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil")
	}
	{
		if err := c.InviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field via_chat_folder_invite_link: %w", err)
		}
		c.ViaChatFolderInviteLink = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberJoinedByInviteLink) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberJoinedByInviteLink")
	b.Comma()
	b.FieldStart("invite_link")
	if err := c.InviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err)
	}
	b.Comma()
	b.FieldStart("via_chat_folder_invite_link")
	b.PutBool(c.ViaChatFolderInviteLink)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberJoinedByInviteLink) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberJoinedByInviteLink"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: %w", err)
			}
		case "invite_link":
			if err := c.InviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err)
			}
		case "via_chat_folder_invite_link":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field via_chat_folder_invite_link: %w", err)
			}
			c.ViaChatFolderInviteLink = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (c *ChatEventMemberJoinedByInviteLink) GetInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.InviteLink
}

// GetViaChatFolderInviteLink returns value of ViaChatFolderInviteLink field.
func (c *ChatEventMemberJoinedByInviteLink) GetViaChatFolderInviteLink() (value bool) {
	if c == nil {
		return
	}
	return c.ViaChatFolderInviteLink
}

// ChatEventMemberJoinedByRequest represents TL type `chatEventMemberJoinedByRequest#9dc87e3f`.
type ChatEventMemberJoinedByRequest struct {
	// User identifier of the chat administrator, approved user join request
	ApproverUserID int64
	// Invite link used to join the chat; may be null
	InviteLink ChatInviteLink
}

// ChatEventMemberJoinedByRequestTypeID is TL type id of ChatEventMemberJoinedByRequest.
const ChatEventMemberJoinedByRequestTypeID = 0x9dc87e3f

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberJoinedByRequest) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberJoinedByRequest{}
)

func (c *ChatEventMemberJoinedByRequest) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.ApproverUserID == 0) {
		return false
	}
	if !(c.InviteLink.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberJoinedByRequest) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberJoinedByRequest",
		ID:   ChatEventMemberJoinedByRequestTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ApproverUserID",
			SchemaName: "approver_user_id",
		},
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberJoinedByRequest) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil")
	}
	b.PutID(ChatEventMemberJoinedByRequestTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberJoinedByRequest) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil")
	}
	b.PutInt53(c.ApproverUserID)
	if err := c.InviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberJoinedByRequest) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil")
	}
	if err := b.ConsumeID(ChatEventMemberJoinedByRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberJoinedByRequest) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field approver_user_id: %w", err)
		}
		c.ApproverUserID = value
	}
	{
		if err := c.InviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberJoinedByRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberJoinedByRequest")
	b.Comma()
	b.FieldStart("approver_user_id")
	b.PutInt53(c.ApproverUserID)
	b.Comma()
	b.FieldStart("invite_link")
	if err := c.InviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberJoinedByRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberJoinedByRequest"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: %w", err)
			}
		case "approver_user_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field approver_user_id: %w", err)
			}
			c.ApproverUserID = value
		case "invite_link":
			if err := c.InviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetApproverUserID returns value of ApproverUserID field.
func (c *ChatEventMemberJoinedByRequest) GetApproverUserID() (value int64) {
	if c == nil {
		return
	}
	return c.ApproverUserID
}

// GetInviteLink returns value of InviteLink field.
func (c *ChatEventMemberJoinedByRequest) GetInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.InviteLink
}

// ChatEventMemberInvited represents TL type `chatEventMemberInvited#38d7bfc9`.
type ChatEventMemberInvited struct {
	// New member user identifier
	UserID int64
	// New member status
	Status ChatMemberStatusClass
}

// ChatEventMemberInvitedTypeID is TL type id of ChatEventMemberInvited.
const ChatEventMemberInvitedTypeID = 0x38d7bfc9

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberInvited) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberInvited{}
)

func (c *ChatEventMemberInvited) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.UserID == 0) {
		return false
	}
	if !(c.Status == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberInvited) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberInvited",
		ID:   ChatEventMemberInvitedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Status",
			SchemaName: "status",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberInvited) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil")
	}
	b.PutID(ChatEventMemberInvitedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberInvited) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil")
	}
	b.PutInt53(c.UserID)
	if c.Status == nil {
		return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil")
	}
	if err := c.Status.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberInvited) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil")
	}
	if err := b.ConsumeID(ChatEventMemberInvitedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberInvited) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err)
		}
		c.UserID = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err)
		}
		c.Status = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberInvited) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberInvited")
	b.Comma()
	b.FieldStart("user_id")
	b.PutInt53(c.UserID)
	b.Comma()
	b.FieldStart("status")
	if c.Status == nil {
		return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil")
	}
	if err := c.Status.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberInvited) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberInvited"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err)
			}
		case "user_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err)
			}
			c.UserID = value
		case "status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err)
			}
			c.Status = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetUserID returns value of UserID field.
func (c *ChatEventMemberInvited) GetUserID() (value int64) {
	if c == nil {
		return
	}
	return c.UserID
}

// GetStatus returns value of Status field.
func (c *ChatEventMemberInvited) GetStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.Status
}

// ChatEventMemberLeft represents TL type `chatEventMemberLeft#c778400f`.
type ChatEventMemberLeft struct {
}

// ChatEventMemberLeftTypeID is TL type id of ChatEventMemberLeft.
const ChatEventMemberLeftTypeID = 0xc778400f

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberLeft) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberLeft{}
)

func (c *ChatEventMemberLeft) Zero() bool {
	if c == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberLeft) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberLeft",
		ID:   ChatEventMemberLeftTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberLeft) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil")
	}
	b.PutID(ChatEventMemberLeftTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberLeft) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberLeft) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil")
	}
	if err := b.ConsumeID(ChatEventMemberLeftTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberLeft) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberLeft) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberLeft")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberLeft) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberLeft"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// ChatEventMemberPromoted represents TL type `chatEventMemberPromoted#1f4f6861`.
type ChatEventMemberPromoted struct {
	// Affected chat member user identifier
	UserID int64
	// Previous status of the chat member
	OldStatus ChatMemberStatusClass
	// New status of the chat member
	NewStatus ChatMemberStatusClass
}

// ChatEventMemberPromotedTypeID is TL type id of ChatEventMemberPromoted.
const ChatEventMemberPromotedTypeID = 0x1f4f6861

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberPromoted) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberPromoted{}
)

func (c *ChatEventMemberPromoted) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.UserID == 0) {
		return false
	}
	if !(c.OldStatus == nil) {
		return false
	}
	if !(c.NewStatus == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberPromoted) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberPromoted",
		ID:   ChatEventMemberPromotedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "OldStatus",
			SchemaName: "old_status",
		},
		{
			Name:       "NewStatus",
			SchemaName: "new_status",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberPromoted) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil")
	}
	b.PutID(ChatEventMemberPromotedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberPromoted) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil")
	}
	b.PutInt53(c.UserID)
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status is nil")
	}
	if err := c.OldStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status: %w", err)
	}
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status is nil")
	}
	if err := c.NewStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberPromoted) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil")
	}
	if err := b.ConsumeID(ChatEventMemberPromotedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberPromoted) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field user_id: %w", err)
		}
		c.UserID = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field old_status: %w", err)
		}
		c.OldStatus = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field new_status: %w", err)
		}
		c.NewStatus = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberPromoted) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberPromoted")
	b.Comma()
	b.FieldStart("user_id")
	b.PutInt53(c.UserID)
	b.Comma()
	b.FieldStart("old_status")
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status is nil")
	}
	if err := c.OldStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status: %w", err)
	}
	b.Comma()
	b.FieldStart("new_status")
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status is nil")
	}
	if err := c.NewStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberPromoted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberPromoted"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: %w", err)
			}
		case "user_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field user_id: %w", err)
			}
			c.UserID = value
		case "old_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field old_status: %w", err)
			}
			c.OldStatus = value
		case "new_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field new_status: %w", err)
			}
			c.NewStatus = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetUserID returns value of UserID field.
func (c *ChatEventMemberPromoted) GetUserID() (value int64) {
	if c == nil {
		return
	}
	return c.UserID
}

// GetOldStatus returns value of OldStatus field.
func (c *ChatEventMemberPromoted) GetOldStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.OldStatus
}

// GetNewStatus returns value of NewStatus field.
func (c *ChatEventMemberPromoted) GetNewStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.NewStatus
}

// ChatEventMemberRestricted represents TL type `chatEventMemberRestricted#5f951e05`.
type ChatEventMemberRestricted struct {
	// Affected chat member identifier
	MemberID MessageSenderClass
	// Previous status of the chat member
	OldStatus ChatMemberStatusClass
	// New status of the chat member
	NewStatus ChatMemberStatusClass
}

// ChatEventMemberRestrictedTypeID is TL type id of ChatEventMemberRestricted.
const ChatEventMemberRestrictedTypeID = 0x5f951e05

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberRestricted) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberRestricted{}
)

func (c *ChatEventMemberRestricted) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.MemberID == nil) {
		return false
	}
	if !(c.OldStatus == nil) {
		return false
	}
	if !(c.NewStatus == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberRestricted) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberRestricted",
		ID:   ChatEventMemberRestrictedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MemberID",
			SchemaName: "member_id",
		},
		{
			Name:       "OldStatus",
			SchemaName: "old_status",
		},
		{
			Name:       "NewStatus",
			SchemaName: "new_status",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberRestricted) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil")
	}
	b.PutID(ChatEventMemberRestrictedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberRestricted) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil")
	}
	if c.MemberID == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id is nil")
	}
	if err := c.MemberID.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id: %w", err)
	}
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status is nil")
	}
	if err := c.OldStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status: %w", err)
	}
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status is nil")
	}
	if err := c.NewStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberRestricted) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil")
	}
	if err := b.ConsumeID(ChatEventMemberRestrictedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberRestricted) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil")
	}
	{
		value, err := DecodeMessageSender(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field member_id: %w", err)
		}
		c.MemberID = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field old_status: %w", err)
		}
		c.OldStatus = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field new_status: %w", err)
		}
		c.NewStatus = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberRestricted) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberRestricted")
	b.Comma()
	b.FieldStart("member_id")
	if c.MemberID == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id is nil")
	}
	if err := c.MemberID.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id: %w", err)
	}
	b.Comma()
	b.FieldStart("old_status")
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status is nil")
	}
	if err := c.OldStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status: %w", err)
	}
	b.Comma()
	b.FieldStart("new_status")
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status is nil")
	}
	if err := c.NewStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberRestricted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberRestricted"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: %w", err)
			}
		case "member_id":
			value, err := DecodeTDLibJSONMessageSender(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field member_id: %w", err)
			}
			c.MemberID = value
		case "old_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field old_status: %w", err)
			}
			c.OldStatus = value
		case "new_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field new_status: %w", err)
			}
			c.NewStatus = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMemberID returns value of MemberID field.
func (c *ChatEventMemberRestricted) GetMemberID() (value MessageSenderClass) {
	if c == nil {
		return
	}
	return c.MemberID
}

// GetOldStatus returns value of OldStatus field.
func (c *ChatEventMemberRestricted) GetOldStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.OldStatus
}

// GetNewStatus returns value of NewStatus field.
func (c *ChatEventMemberRestricted) GetNewStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.NewStatus
}

// ChatEventMemberSubscriptionExtended represents TL type `chatEventMemberSubscriptionExtended#bbfab002`.
type ChatEventMemberSubscriptionExtended struct {
	// Affected chat member user identifier
	UserID int64
	// Previous status of the chat member
	OldStatus ChatMemberStatusClass
	// New status of the chat member
	NewStatus ChatMemberStatusClass
}

// ChatEventMemberSubscriptionExtendedTypeID is TL type id of ChatEventMemberSubscriptionExtended.
const ChatEventMemberSubscriptionExtendedTypeID = 0xbbfab002

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMemberSubscriptionExtended) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMemberSubscriptionExtended{}
)

func (c *ChatEventMemberSubscriptionExtended) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.UserID == 0) {
		return false
	}
	if !(c.OldStatus == nil) {
		return false
	}
	if !(c.NewStatus == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMemberSubscriptionExtended) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMemberSubscriptionExtended",
		ID:   ChatEventMemberSubscriptionExtendedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "OldStatus",
			SchemaName: "old_status",
		},
		{
			Name:       "NewStatus",
			SchemaName: "new_status",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMemberSubscriptionExtended) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil")
	}
	b.PutID(ChatEventMemberSubscriptionExtendedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMemberSubscriptionExtended) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil")
	}
	b.PutInt53(c.UserID)
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil")
	}
	if err := c.OldStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err)
	}
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil")
	}
	if err := c.NewStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMemberSubscriptionExtended) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil")
	}
	if err := b.ConsumeID(ChatEventMemberSubscriptionExtendedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMemberSubscriptionExtended) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err)
		}
		c.UserID = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err)
		}
		c.OldStatus = value
	}
	{
		value, err := DecodeChatMemberStatus(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err)
		}
		c.NewStatus = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMemberSubscriptionExtended) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMemberSubscriptionExtended")
	b.Comma()
	b.FieldStart("user_id")
	b.PutInt53(c.UserID)
	b.Comma()
	b.FieldStart("old_status")
	if c.OldStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil")
	}
	if err := c.OldStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err)
	}
	b.Comma()
	b.FieldStart("new_status")
	if c.NewStatus == nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil")
	}
	if err := c.NewStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMemberSubscriptionExtended) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMemberSubscriptionExtended"); err != nil {
				return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err)
			}
		case "user_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err)
			}
			c.UserID = value
		case "old_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err)
			}
			c.OldStatus = value
		case "new_status":
			value, err := DecodeTDLibJSONChatMemberStatus(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err)
			}
			c.NewStatus = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetUserID returns value of UserID field.
func (c *ChatEventMemberSubscriptionExtended) GetUserID() (value int64) {
	if c == nil {
		return
	}
	return c.UserID
}

// GetOldStatus returns value of OldStatus field.
func (c *ChatEventMemberSubscriptionExtended) GetOldStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.OldStatus
}

// GetNewStatus returns value of NewStatus field.
func (c *ChatEventMemberSubscriptionExtended) GetNewStatus() (value ChatMemberStatusClass) {
	if c == nil {
		return
	}
	return c.NewStatus
}

// ChatEventAvailableReactionsChanged represents TL type `chatEventAvailableReactionsChanged#97b8e0bf`.
type ChatEventAvailableReactionsChanged struct {
	// Previous chat available reactions
	OldAvailableReactions ChatAvailableReactionsClass
	// New chat available reactions
	NewAvailableReactions ChatAvailableReactionsClass
}

// ChatEventAvailableReactionsChangedTypeID is TL type id of ChatEventAvailableReactionsChanged.
const ChatEventAvailableReactionsChangedTypeID = 0x97b8e0bf

// construct implements constructor of ChatEventActionClass.
func (c ChatEventAvailableReactionsChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventAvailableReactionsChanged{}
)

func (c *ChatEventAvailableReactionsChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldAvailableReactions == nil) {
		return false
	}
	if !(c.NewAvailableReactions == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventAvailableReactionsChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventAvailableReactionsChanged",
		ID:   ChatEventAvailableReactionsChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldAvailableReactions",
			SchemaName: "old_available_reactions",
		},
		{
			Name:       "NewAvailableReactions",
			SchemaName: "new_available_reactions",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventAvailableReactionsChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil")
	}
	b.PutID(ChatEventAvailableReactionsChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventAvailableReactionsChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil")
	}
	if c.OldAvailableReactions == nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions is nil")
	}
	if err := c.OldAvailableReactions.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err)
	}
	if c.NewAvailableReactions == nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions is nil")
	}
	if err := c.NewAvailableReactions.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventAvailableReactionsChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil")
	}
	if err := b.ConsumeID(ChatEventAvailableReactionsChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventAvailableReactionsChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil")
	}
	{
		value, err := DecodeChatAvailableReactions(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err)
		}
		c.OldAvailableReactions = value
	}
	{
		value, err := DecodeChatAvailableReactions(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err)
		}
		c.NewAvailableReactions = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventAvailableReactionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil")
	}
	b.ObjStart()
	b.PutID("chatEventAvailableReactionsChanged")
	b.Comma()
	b.FieldStart("old_available_reactions")
	if c.OldAvailableReactions == nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions is nil")
	}
	if err := c.OldAvailableReactions.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err)
	}
	b.Comma()
	b.FieldStart("new_available_reactions")
	if c.NewAvailableReactions == nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions is nil")
	}
	if err := c.NewAvailableReactions.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventAvailableReactionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventAvailableReactionsChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: %w", err)
			}
		case "old_available_reactions":
			value, err := DecodeTDLibJSONChatAvailableReactions(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err)
			}
			c.OldAvailableReactions = value
		case "new_available_reactions":
			value, err := DecodeTDLibJSONChatAvailableReactions(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err)
			}
			c.NewAvailableReactions = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldAvailableReactions returns value of OldAvailableReactions field.
func (c *ChatEventAvailableReactionsChanged) GetOldAvailableReactions() (value ChatAvailableReactionsClass) {
	if c == nil {
		return
	}
	return c.OldAvailableReactions
}

// GetNewAvailableReactions returns value of NewAvailableReactions field.
func (c *ChatEventAvailableReactionsChanged) GetNewAvailableReactions() (value ChatAvailableReactionsClass) {
	if c == nil {
		return
	}
	return c.NewAvailableReactions
}

// ChatEventBackgroundChanged represents TL type `chatEventBackgroundChanged#b6ed6d38`.
type ChatEventBackgroundChanged struct {
	// Previous background; may be null if none
	OldBackground ChatBackground
	// New background; may be null if none
	NewBackground ChatBackground
}

// ChatEventBackgroundChangedTypeID is TL type id of ChatEventBackgroundChanged.
const ChatEventBackgroundChangedTypeID = 0xb6ed6d38

// construct implements constructor of ChatEventActionClass.
func (c ChatEventBackgroundChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventBackgroundChanged{}
)

func (c *ChatEventBackgroundChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldBackground.Zero()) {
		return false
	}
	if !(c.NewBackground.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventBackgroundChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventBackgroundChanged",
		ID:   ChatEventBackgroundChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldBackground",
			SchemaName: "old_background",
		},
		{
			Name:       "NewBackground",
			SchemaName: "new_background",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventBackgroundChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil")
	}
	b.PutID(ChatEventBackgroundChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventBackgroundChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil")
	}
	if err := c.OldBackground.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err)
	}
	if err := c.NewBackground.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventBackgroundChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil")
	}
	if err := b.ConsumeID(ChatEventBackgroundChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventBackgroundChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil")
	}
	{
		if err := c.OldBackground.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err)
		}
	}
	{
		if err := c.NewBackground.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventBackgroundChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventBackgroundChanged")
	b.Comma()
	b.FieldStart("old_background")
	if err := c.OldBackground.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err)
	}
	b.Comma()
	b.FieldStart("new_background")
	if err := c.NewBackground.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventBackgroundChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventBackgroundChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: %w", err)
			}
		case "old_background":
			if err := c.OldBackground.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err)
			}
		case "new_background":
			if err := c.NewBackground.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldBackground returns value of OldBackground field.
func (c *ChatEventBackgroundChanged) GetOldBackground() (value ChatBackground) {
	if c == nil {
		return
	}
	return c.OldBackground
}

// GetNewBackground returns value of NewBackground field.
func (c *ChatEventBackgroundChanged) GetNewBackground() (value ChatBackground) {
	if c == nil {
		return
	}
	return c.NewBackground
}

// ChatEventDescriptionChanged represents TL type `chatEventDescriptionChanged#254cf1e`.
type ChatEventDescriptionChanged struct {
	// Previous chat description
	OldDescription string
	// New chat description
	NewDescription string
}

// ChatEventDescriptionChangedTypeID is TL type id of ChatEventDescriptionChanged.
const ChatEventDescriptionChangedTypeID = 0x254cf1e

// construct implements constructor of ChatEventActionClass.
func (c ChatEventDescriptionChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventDescriptionChanged{}
)

func (c *ChatEventDescriptionChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldDescription == "") {
		return false
	}
	if !(c.NewDescription == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventDescriptionChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventDescriptionChanged",
		ID:   ChatEventDescriptionChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldDescription",
			SchemaName: "old_description",
		},
		{
			Name:       "NewDescription",
			SchemaName: "new_description",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventDescriptionChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil")
	}
	b.PutID(ChatEventDescriptionChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventDescriptionChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil")
	}
	b.PutString(c.OldDescription)
	b.PutString(c.NewDescription)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventDescriptionChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil")
	}
	if err := b.ConsumeID(ChatEventDescriptionChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventDescriptionChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err)
		}
		c.OldDescription = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err)
		}
		c.NewDescription = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventDescriptionChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil")
	}
	b.ObjStart()
	b.PutID("chatEventDescriptionChanged")
	b.Comma()
	b.FieldStart("old_description")
	b.PutString(c.OldDescription)
	b.Comma()
	b.FieldStart("new_description")
	b.PutString(c.NewDescription)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventDescriptionChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventDescriptionChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err)
			}
		case "old_description":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err)
			}
			c.OldDescription = value
		case "new_description":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err)
			}
			c.NewDescription = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldDescription returns value of OldDescription field.
func (c *ChatEventDescriptionChanged) GetOldDescription() (value string) {
	if c == nil {
		return
	}
	return c.OldDescription
}

// GetNewDescription returns value of NewDescription field.
func (c *ChatEventDescriptionChanged) GetNewDescription() (value string) {
	if c == nil {
		return
	}
	return c.NewDescription
}

// ChatEventEmojiStatusChanged represents TL type `chatEventEmojiStatusChanged#83e97b1e`.
type ChatEventEmojiStatusChanged struct {
	// Previous emoji status; may be null if none
	OldEmojiStatus EmojiStatus
	// New emoji status; may be null if none
	NewEmojiStatus EmojiStatus
}

// ChatEventEmojiStatusChangedTypeID is TL type id of ChatEventEmojiStatusChanged.
const ChatEventEmojiStatusChangedTypeID = 0x83e97b1e

// construct implements constructor of ChatEventActionClass.
func (c ChatEventEmojiStatusChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventEmojiStatusChanged{}
)

func (c *ChatEventEmojiStatusChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldEmojiStatus.Zero()) {
		return false
	}
	if !(c.NewEmojiStatus.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventEmojiStatusChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventEmojiStatusChanged",
		ID:   ChatEventEmojiStatusChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldEmojiStatus",
			SchemaName: "old_emoji_status",
		},
		{
			Name:       "NewEmojiStatus",
			SchemaName: "new_emoji_status",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventEmojiStatusChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil")
	}
	b.PutID(ChatEventEmojiStatusChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventEmojiStatusChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil")
	}
	if err := c.OldEmojiStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err)
	}
	if err := c.NewEmojiStatus.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventEmojiStatusChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil")
	}
	if err := b.ConsumeID(ChatEventEmojiStatusChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventEmojiStatusChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil")
	}
	{
		if err := c.OldEmojiStatus.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err)
		}
	}
	{
		if err := c.NewEmojiStatus.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventEmojiStatusChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil")
	}
	b.ObjStart()
	b.PutID("chatEventEmojiStatusChanged")
	b.Comma()
	b.FieldStart("old_emoji_status")
	if err := c.OldEmojiStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err)
	}
	b.Comma()
	b.FieldStart("new_emoji_status")
	if err := c.NewEmojiStatus.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventEmojiStatusChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventEmojiStatusChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: %w", err)
			}
		case "old_emoji_status":
			if err := c.OldEmojiStatus.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err)
			}
		case "new_emoji_status":
			if err := c.NewEmojiStatus.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldEmojiStatus returns value of OldEmojiStatus field.
func (c *ChatEventEmojiStatusChanged) GetOldEmojiStatus() (value EmojiStatus) {
	if c == nil {
		return
	}
	return c.OldEmojiStatus
}

// GetNewEmojiStatus returns value of NewEmojiStatus field.
func (c *ChatEventEmojiStatusChanged) GetNewEmojiStatus() (value EmojiStatus) {
	if c == nil {
		return
	}
	return c.NewEmojiStatus
}

// ChatEventLinkedChatChanged represents TL type `chatEventLinkedChatChanged#6b2271af`.
type ChatEventLinkedChatChanged struct {
	// Previous supergroup linked chat identifier
	OldLinkedChatID int64
	// New supergroup linked chat identifier
	NewLinkedChatID int64
}

// ChatEventLinkedChatChangedTypeID is TL type id of ChatEventLinkedChatChanged.
const ChatEventLinkedChatChangedTypeID = 0x6b2271af

// construct implements constructor of ChatEventActionClass.
func (c ChatEventLinkedChatChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventLinkedChatChanged{}
)

func (c *ChatEventLinkedChatChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldLinkedChatID == 0) {
		return false
	}
	if !(c.NewLinkedChatID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventLinkedChatChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventLinkedChatChanged",
		ID:   ChatEventLinkedChatChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldLinkedChatID",
			SchemaName: "old_linked_chat_id",
		},
		{
			Name:       "NewLinkedChatID",
			SchemaName: "new_linked_chat_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventLinkedChatChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil")
	}
	b.PutID(ChatEventLinkedChatChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventLinkedChatChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil")
	}
	b.PutInt53(c.OldLinkedChatID)
	b.PutInt53(c.NewLinkedChatID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventLinkedChatChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil")
	}
	if err := b.ConsumeID(ChatEventLinkedChatChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventLinkedChatChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err)
		}
		c.OldLinkedChatID = value
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err)
		}
		c.NewLinkedChatID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventLinkedChatChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil")
	}
	b.ObjStart()
	b.PutID("chatEventLinkedChatChanged")
	b.Comma()
	b.FieldStart("old_linked_chat_id")
	b.PutInt53(c.OldLinkedChatID)
	b.Comma()
	b.FieldStart("new_linked_chat_id")
	b.PutInt53(c.NewLinkedChatID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventLinkedChatChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventLinkedChatChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err)
			}
		case "old_linked_chat_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err)
			}
			c.OldLinkedChatID = value
		case "new_linked_chat_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err)
			}
			c.NewLinkedChatID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldLinkedChatID returns value of OldLinkedChatID field.
func (c *ChatEventLinkedChatChanged) GetOldLinkedChatID() (value int64) {
	if c == nil {
		return
	}
	return c.OldLinkedChatID
}

// GetNewLinkedChatID returns value of NewLinkedChatID field.
func (c *ChatEventLinkedChatChanged) GetNewLinkedChatID() (value int64) {
	if c == nil {
		return
	}
	return c.NewLinkedChatID
}

// ChatEventLocationChanged represents TL type `chatEventLocationChanged#e7cdfd4e`.
type ChatEventLocationChanged struct {
	// Previous location; may be null
	OldLocation ChatLocation
	// New location; may be null
	NewLocation ChatLocation
}

// ChatEventLocationChangedTypeID is TL type id of ChatEventLocationChanged.
const ChatEventLocationChangedTypeID = 0xe7cdfd4e

// construct implements constructor of ChatEventActionClass.
func (c ChatEventLocationChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventLocationChanged{}
)

func (c *ChatEventLocationChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldLocation.Zero()) {
		return false
	}
	if !(c.NewLocation.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventLocationChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventLocationChanged",
		ID:   ChatEventLocationChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldLocation",
			SchemaName: "old_location",
		},
		{
			Name:       "NewLocation",
			SchemaName: "new_location",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventLocationChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil")
	}
	b.PutID(ChatEventLocationChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventLocationChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil")
	}
	if err := c.OldLocation.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err)
	}
	if err := c.NewLocation.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventLocationChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil")
	}
	if err := b.ConsumeID(ChatEventLocationChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventLocationChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil")
	}
	{
		if err := c.OldLocation.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err)
		}
	}
	{
		if err := c.NewLocation.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventLocationChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil")
	}
	b.ObjStart()
	b.PutID("chatEventLocationChanged")
	b.Comma()
	b.FieldStart("old_location")
	if err := c.OldLocation.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err)
	}
	b.Comma()
	b.FieldStart("new_location")
	if err := c.NewLocation.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventLocationChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventLocationChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err)
			}
		case "old_location":
			if err := c.OldLocation.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err)
			}
		case "new_location":
			if err := c.NewLocation.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldLocation returns value of OldLocation field.
func (c *ChatEventLocationChanged) GetOldLocation() (value ChatLocation) {
	if c == nil {
		return
	}
	return c.OldLocation
}

// GetNewLocation returns value of NewLocation field.
func (c *ChatEventLocationChanged) GetNewLocation() (value ChatLocation) {
	if c == nil {
		return
	}
	return c.NewLocation
}

// ChatEventMessageAutoDeleteTimeChanged represents TL type `chatEventMessageAutoDeleteTimeChanged#1083f24`.
type ChatEventMessageAutoDeleteTimeChanged struct {
	// Previous value of message_auto_delete_time
	OldMessageAutoDeleteTime int32
	// New value of message_auto_delete_time
	NewMessageAutoDeleteTime int32
}

// ChatEventMessageAutoDeleteTimeChangedTypeID is TL type id of ChatEventMessageAutoDeleteTimeChanged.
const ChatEventMessageAutoDeleteTimeChangedTypeID = 0x1083f24

// construct implements constructor of ChatEventActionClass.
func (c ChatEventMessageAutoDeleteTimeChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventMessageAutoDeleteTimeChanged{}
)

func (c *ChatEventMessageAutoDeleteTimeChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldMessageAutoDeleteTime == 0) {
		return false
	}
	if !(c.NewMessageAutoDeleteTime == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventMessageAutoDeleteTimeChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventMessageAutoDeleteTimeChanged",
		ID:   ChatEventMessageAutoDeleteTimeChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldMessageAutoDeleteTime",
			SchemaName: "old_message_auto_delete_time",
		},
		{
			Name:       "NewMessageAutoDeleteTime",
			SchemaName: "new_message_auto_delete_time",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil")
	}
	b.PutID(ChatEventMessageAutoDeleteTimeChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil")
	}
	b.PutInt32(c.OldMessageAutoDeleteTime)
	b.PutInt32(c.NewMessageAutoDeleteTime)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil")
	}
	if err := b.ConsumeID(ChatEventMessageAutoDeleteTimeChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field old_message_auto_delete_time: %w", err)
		}
		c.OldMessageAutoDeleteTime = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field new_message_auto_delete_time: %w", err)
		}
		c.NewMessageAutoDeleteTime = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventMessageAutoDeleteTimeChanged")
	b.Comma()
	b.FieldStart("old_message_auto_delete_time")
	b.PutInt32(c.OldMessageAutoDeleteTime)
	b.Comma()
	b.FieldStart("new_message_auto_delete_time")
	b.PutInt32(c.NewMessageAutoDeleteTime)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventMessageAutoDeleteTimeChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventMessageAutoDeleteTimeChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: %w", err)
			}
		case "old_message_auto_delete_time":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field old_message_auto_delete_time: %w", err)
			}
			c.OldMessageAutoDeleteTime = value
		case "new_message_auto_delete_time":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field new_message_auto_delete_time: %w", err)
			}
			c.NewMessageAutoDeleteTime = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldMessageAutoDeleteTime returns value of OldMessageAutoDeleteTime field.
func (c *ChatEventMessageAutoDeleteTimeChanged) GetOldMessageAutoDeleteTime() (value int32) {
	if c == nil {
		return
	}
	return c.OldMessageAutoDeleteTime
}

// GetNewMessageAutoDeleteTime returns value of NewMessageAutoDeleteTime field.
func (c *ChatEventMessageAutoDeleteTimeChanged) GetNewMessageAutoDeleteTime() (value int32) {
	if c == nil {
		return
	}
	return c.NewMessageAutoDeleteTime
}

// ChatEventPermissionsChanged represents TL type `chatEventPermissionsChanged#b1d337a8`.
type ChatEventPermissionsChanged struct {
	// Previous chat permissions
	OldPermissions ChatPermissions
	// New chat permissions
	NewPermissions ChatPermissions
}

// ChatEventPermissionsChangedTypeID is TL type id of ChatEventPermissionsChanged.
const ChatEventPermissionsChangedTypeID = 0xb1d337a8

// construct implements constructor of ChatEventActionClass.
func (c ChatEventPermissionsChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventPermissionsChanged{}
)

func (c *ChatEventPermissionsChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldPermissions.Zero()) {
		return false
	}
	if !(c.NewPermissions.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventPermissionsChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventPermissionsChanged",
		ID:   ChatEventPermissionsChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldPermissions",
			SchemaName: "old_permissions",
		},
		{
			Name:       "NewPermissions",
			SchemaName: "new_permissions",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventPermissionsChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil")
	}
	b.PutID(ChatEventPermissionsChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventPermissionsChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil")
	}
	if err := c.OldPermissions.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err)
	}
	if err := c.NewPermissions.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventPermissionsChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil")
	}
	if err := b.ConsumeID(ChatEventPermissionsChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventPermissionsChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil")
	}
	{
		if err := c.OldPermissions.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err)
		}
	}
	{
		if err := c.NewPermissions.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventPermissionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventPermissionsChanged")
	b.Comma()
	b.FieldStart("old_permissions")
	if err := c.OldPermissions.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err)
	}
	b.Comma()
	b.FieldStart("new_permissions")
	if err := c.NewPermissions.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventPermissionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventPermissionsChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err)
			}
		case "old_permissions":
			if err := c.OldPermissions.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err)
			}
		case "new_permissions":
			if err := c.NewPermissions.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldPermissions returns value of OldPermissions field.
func (c *ChatEventPermissionsChanged) GetOldPermissions() (value ChatPermissions) {
	if c == nil {
		return
	}
	return c.OldPermissions
}

// GetNewPermissions returns value of NewPermissions field.
func (c *ChatEventPermissionsChanged) GetNewPermissions() (value ChatPermissions) {
	if c == nil {
		return
	}
	return c.NewPermissions
}

// ChatEventPhotoChanged represents TL type `chatEventPhotoChanged#cfa062c3`.
type ChatEventPhotoChanged struct {
	// Previous chat photo value; may be null
	OldPhoto ChatPhoto
	// New chat photo value; may be null
	NewPhoto ChatPhoto
}

// ChatEventPhotoChangedTypeID is TL type id of ChatEventPhotoChanged.
const ChatEventPhotoChangedTypeID = 0xcfa062c3

// construct implements constructor of ChatEventActionClass.
func (c ChatEventPhotoChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventPhotoChanged{}
)

func (c *ChatEventPhotoChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldPhoto.Zero()) {
		return false
	}
	if !(c.NewPhoto.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventPhotoChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventPhotoChanged",
		ID:   ChatEventPhotoChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldPhoto",
			SchemaName: "old_photo",
		},
		{
			Name:       "NewPhoto",
			SchemaName: "new_photo",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventPhotoChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil")
	}
	b.PutID(ChatEventPhotoChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventPhotoChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil")
	}
	if err := c.OldPhoto.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err)
	}
	if err := c.NewPhoto.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventPhotoChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil")
	}
	if err := b.ConsumeID(ChatEventPhotoChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventPhotoChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil")
	}
	{
		if err := c.OldPhoto.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err)
		}
	}
	{
		if err := c.NewPhoto.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventPhotoChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventPhotoChanged")
	b.Comma()
	b.FieldStart("old_photo")
	if err := c.OldPhoto.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err)
	}
	b.Comma()
	b.FieldStart("new_photo")
	if err := c.NewPhoto.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventPhotoChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventPhotoChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err)
			}
		case "old_photo":
			if err := c.OldPhoto.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err)
			}
		case "new_photo":
			if err := c.NewPhoto.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldPhoto returns value of OldPhoto field.
func (c *ChatEventPhotoChanged) GetOldPhoto() (value ChatPhoto) {
	if c == nil {
		return
	}
	return c.OldPhoto
}

// GetNewPhoto returns value of NewPhoto field.
func (c *ChatEventPhotoChanged) GetNewPhoto() (value ChatPhoto) {
	if c == nil {
		return
	}
	return c.NewPhoto
}

// ChatEventSlowModeDelayChanged represents TL type `chatEventSlowModeDelayChanged#9d763c0b`.
type ChatEventSlowModeDelayChanged struct {
	// Previous value of slow_mode_delay, in seconds
	OldSlowModeDelay int32
	// New value of slow_mode_delay, in seconds
	NewSlowModeDelay int32
}

// ChatEventSlowModeDelayChangedTypeID is TL type id of ChatEventSlowModeDelayChanged.
const ChatEventSlowModeDelayChangedTypeID = 0x9d763c0b

// construct implements constructor of ChatEventActionClass.
func (c ChatEventSlowModeDelayChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventSlowModeDelayChanged{}
)

func (c *ChatEventSlowModeDelayChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldSlowModeDelay == 0) {
		return false
	}
	if !(c.NewSlowModeDelay == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventSlowModeDelayChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventSlowModeDelayChanged",
		ID:   ChatEventSlowModeDelayChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldSlowModeDelay",
			SchemaName: "old_slow_mode_delay",
		},
		{
			Name:       "NewSlowModeDelay",
			SchemaName: "new_slow_mode_delay",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventSlowModeDelayChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil")
	}
	b.PutID(ChatEventSlowModeDelayChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventSlowModeDelayChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil")
	}
	b.PutInt32(c.OldSlowModeDelay)
	b.PutInt32(c.NewSlowModeDelay)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventSlowModeDelayChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil")
	}
	if err := b.ConsumeID(ChatEventSlowModeDelayChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventSlowModeDelayChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field old_slow_mode_delay: %w", err)
		}
		c.OldSlowModeDelay = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field new_slow_mode_delay: %w", err)
		}
		c.NewSlowModeDelay = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventSlowModeDelayChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil")
	}
	b.ObjStart()
	b.PutID("chatEventSlowModeDelayChanged")
	b.Comma()
	b.FieldStart("old_slow_mode_delay")
	b.PutInt32(c.OldSlowModeDelay)
	b.Comma()
	b.FieldStart("new_slow_mode_delay")
	b.PutInt32(c.NewSlowModeDelay)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventSlowModeDelayChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventSlowModeDelayChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: %w", err)
			}
		case "old_slow_mode_delay":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field old_slow_mode_delay: %w", err)
			}
			c.OldSlowModeDelay = value
		case "new_slow_mode_delay":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field new_slow_mode_delay: %w", err)
			}
			c.NewSlowModeDelay = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldSlowModeDelay returns value of OldSlowModeDelay field.
func (c *ChatEventSlowModeDelayChanged) GetOldSlowModeDelay() (value int32) {
	if c == nil {
		return
	}
	return c.OldSlowModeDelay
}

// GetNewSlowModeDelay returns value of NewSlowModeDelay field.
func (c *ChatEventSlowModeDelayChanged) GetNewSlowModeDelay() (value int32) {
	if c == nil {
		return
	}
	return c.NewSlowModeDelay
}

// ChatEventStickerSetChanged represents TL type `chatEventStickerSetChanged#b5e7558f`.
type ChatEventStickerSetChanged struct {
	// Previous identifier of the chat sticker set; 0 if none
	OldStickerSetID int64
	// New identifier of the chat sticker set; 0 if none
	NewStickerSetID int64
}

// ChatEventStickerSetChangedTypeID is TL type id of ChatEventStickerSetChanged.
const ChatEventStickerSetChangedTypeID = 0xb5e7558f

// construct implements constructor of ChatEventActionClass.
func (c ChatEventStickerSetChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventStickerSetChanged{}
)

func (c *ChatEventStickerSetChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldStickerSetID == 0) {
		return false
	}
	if !(c.NewStickerSetID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventStickerSetChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventStickerSetChanged",
		ID:   ChatEventStickerSetChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldStickerSetID",
			SchemaName: "old_sticker_set_id",
		},
		{
			Name:       "NewStickerSetID",
			SchemaName: "new_sticker_set_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventStickerSetChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil")
	}
	b.PutID(ChatEventStickerSetChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventStickerSetChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil")
	}
	b.PutLong(c.OldStickerSetID)
	b.PutLong(c.NewStickerSetID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventStickerSetChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil")
	}
	if err := b.ConsumeID(ChatEventStickerSetChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventStickerSetChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err)
		}
		c.OldStickerSetID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err)
		}
		c.NewStickerSetID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil")
	}
	b.ObjStart()
	b.PutID("chatEventStickerSetChanged")
	b.Comma()
	b.FieldStart("old_sticker_set_id")
	b.PutLong(c.OldStickerSetID)
	b.Comma()
	b.FieldStart("new_sticker_set_id")
	b.PutLong(c.NewStickerSetID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventStickerSetChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err)
			}
		case "old_sticker_set_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err)
			}
			c.OldStickerSetID = value
		case "new_sticker_set_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err)
			}
			c.NewStickerSetID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldStickerSetID returns value of OldStickerSetID field.
func (c *ChatEventStickerSetChanged) GetOldStickerSetID() (value int64) {
	if c == nil {
		return
	}
	return c.OldStickerSetID
}

// GetNewStickerSetID returns value of NewStickerSetID field.
func (c *ChatEventStickerSetChanged) GetNewStickerSetID() (value int64) {
	if c == nil {
		return
	}
	return c.NewStickerSetID
}

// ChatEventCustomEmojiStickerSetChanged represents TL type `chatEventCustomEmojiStickerSetChanged#70c431b`.
type ChatEventCustomEmojiStickerSetChanged struct {
	// Previous identifier of the chat sticker set; 0 if none
	OldStickerSetID int64
	// New identifier of the chat sticker set; 0 if none
	NewStickerSetID int64
}

// ChatEventCustomEmojiStickerSetChangedTypeID is TL type id of ChatEventCustomEmojiStickerSetChanged.
const ChatEventCustomEmojiStickerSetChangedTypeID = 0x70c431b

// construct implements constructor of ChatEventActionClass.
func (c ChatEventCustomEmojiStickerSetChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventCustomEmojiStickerSetChanged{}
)

func (c *ChatEventCustomEmojiStickerSetChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldStickerSetID == 0) {
		return false
	}
	if !(c.NewStickerSetID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventCustomEmojiStickerSetChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventCustomEmojiStickerSetChanged",
		ID:   ChatEventCustomEmojiStickerSetChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldStickerSetID",
			SchemaName: "old_sticker_set_id",
		},
		{
			Name:       "NewStickerSetID",
			SchemaName: "new_sticker_set_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventCustomEmojiStickerSetChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil")
	}
	b.PutID(ChatEventCustomEmojiStickerSetChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventCustomEmojiStickerSetChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil")
	}
	b.PutLong(c.OldStickerSetID)
	b.PutLong(c.NewStickerSetID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventCustomEmojiStickerSetChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil")
	}
	if err := b.ConsumeID(ChatEventCustomEmojiStickerSetChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventCustomEmojiStickerSetChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err)
		}
		c.OldStickerSetID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err)
		}
		c.NewStickerSetID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventCustomEmojiStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil")
	}
	b.ObjStart()
	b.PutID("chatEventCustomEmojiStickerSetChanged")
	b.Comma()
	b.FieldStart("old_sticker_set_id")
	b.PutLong(c.OldStickerSetID)
	b.Comma()
	b.FieldStart("new_sticker_set_id")
	b.PutLong(c.NewStickerSetID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventCustomEmojiStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventCustomEmojiStickerSetChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err)
			}
		case "old_sticker_set_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err)
			}
			c.OldStickerSetID = value
		case "new_sticker_set_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err)
			}
			c.NewStickerSetID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldStickerSetID returns value of OldStickerSetID field.
func (c *ChatEventCustomEmojiStickerSetChanged) GetOldStickerSetID() (value int64) {
	if c == nil {
		return
	}
	return c.OldStickerSetID
}

// GetNewStickerSetID returns value of NewStickerSetID field.
func (c *ChatEventCustomEmojiStickerSetChanged) GetNewStickerSetID() (value int64) {
	if c == nil {
		return
	}
	return c.NewStickerSetID
}

// ChatEventTitleChanged represents TL type `chatEventTitleChanged#43990ad2`.
type ChatEventTitleChanged struct {
	// Previous chat title
	OldTitle string
	// New chat title
	NewTitle string
}

// ChatEventTitleChangedTypeID is TL type id of ChatEventTitleChanged.
const ChatEventTitleChangedTypeID = 0x43990ad2

// construct implements constructor of ChatEventActionClass.
func (c ChatEventTitleChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventTitleChanged{}
)

func (c *ChatEventTitleChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldTitle == "") {
		return false
	}
	if !(c.NewTitle == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventTitleChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventTitleChanged",
		ID:   ChatEventTitleChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldTitle",
			SchemaName: "old_title",
		},
		{
			Name:       "NewTitle",
			SchemaName: "new_title",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventTitleChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil")
	}
	b.PutID(ChatEventTitleChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventTitleChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil")
	}
	b.PutString(c.OldTitle)
	b.PutString(c.NewTitle)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventTitleChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil")
	}
	if err := b.ConsumeID(ChatEventTitleChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventTitleChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err)
		}
		c.OldTitle = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err)
		}
		c.NewTitle = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventTitleChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventTitleChanged")
	b.Comma()
	b.FieldStart("old_title")
	b.PutString(c.OldTitle)
	b.Comma()
	b.FieldStart("new_title")
	b.PutString(c.NewTitle)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventTitleChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventTitleChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err)
			}
		case "old_title":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err)
			}
			c.OldTitle = value
		case "new_title":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err)
			}
			c.NewTitle = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldTitle returns value of OldTitle field.
func (c *ChatEventTitleChanged) GetOldTitle() (value string) {
	if c == nil {
		return
	}
	return c.OldTitle
}

// GetNewTitle returns value of NewTitle field.
func (c *ChatEventTitleChanged) GetNewTitle() (value string) {
	if c == nil {
		return
	}
	return c.NewTitle
}

// ChatEventUsernameChanged represents TL type `chatEventUsernameChanged#6707b56b`.
type ChatEventUsernameChanged struct {
	// Previous chat username
	OldUsername string
	// New chat username
	NewUsername string
}

// ChatEventUsernameChangedTypeID is TL type id of ChatEventUsernameChanged.
const ChatEventUsernameChangedTypeID = 0x6707b56b

// construct implements constructor of ChatEventActionClass.
func (c ChatEventUsernameChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventUsernameChanged{}
)

func (c *ChatEventUsernameChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldUsername == "") {
		return false
	}
	if !(c.NewUsername == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventUsernameChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventUsernameChanged",
		ID:   ChatEventUsernameChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldUsername",
			SchemaName: "old_username",
		},
		{
			Name:       "NewUsername",
			SchemaName: "new_username",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventUsernameChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil")
	}
	b.PutID(ChatEventUsernameChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventUsernameChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil")
	}
	b.PutString(c.OldUsername)
	b.PutString(c.NewUsername)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventUsernameChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil")
	}
	if err := b.ConsumeID(ChatEventUsernameChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventUsernameChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err)
		}
		c.OldUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err)
		}
		c.NewUsername = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventUsernameChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil")
	}
	b.ObjStart()
	b.PutID("chatEventUsernameChanged")
	b.Comma()
	b.FieldStart("old_username")
	b.PutString(c.OldUsername)
	b.Comma()
	b.FieldStart("new_username")
	b.PutString(c.NewUsername)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventUsernameChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventUsernameChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err)
			}
		case "old_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err)
			}
			c.OldUsername = value
		case "new_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err)
			}
			c.NewUsername = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldUsername returns value of OldUsername field.
func (c *ChatEventUsernameChanged) GetOldUsername() (value string) {
	if c == nil {
		return
	}
	return c.OldUsername
}

// GetNewUsername returns value of NewUsername field.
func (c *ChatEventUsernameChanged) GetNewUsername() (value string) {
	if c == nil {
		return
	}
	return c.NewUsername
}

// ChatEventActiveUsernamesChanged represents TL type `chatEventActiveUsernamesChanged#95e54656`.
type ChatEventActiveUsernamesChanged struct {
	// Previous list of active usernames
	OldUsernames []string
	// New list of active usernames
	NewUsernames []string
}

// ChatEventActiveUsernamesChangedTypeID is TL type id of ChatEventActiveUsernamesChanged.
const ChatEventActiveUsernamesChangedTypeID = 0x95e54656

// construct implements constructor of ChatEventActionClass.
func (c ChatEventActiveUsernamesChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventActiveUsernamesChanged{}
)

func (c *ChatEventActiveUsernamesChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldUsernames == nil) {
		return false
	}
	if !(c.NewUsernames == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventActiveUsernamesChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventActiveUsernamesChanged",
		ID:   ChatEventActiveUsernamesChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldUsernames",
			SchemaName: "old_usernames",
		},
		{
			Name:       "NewUsernames",
			SchemaName: "new_usernames",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventActiveUsernamesChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil")
	}
	b.PutID(ChatEventActiveUsernamesChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventActiveUsernamesChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil")
	}
	b.PutInt(len(c.OldUsernames))
	for _, v := range c.OldUsernames {
		b.PutString(v)
	}
	b.PutInt(len(c.NewUsernames))
	for _, v := range c.NewUsernames {
		b.PutString(v)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventActiveUsernamesChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil")
	}
	if err := b.ConsumeID(ChatEventActiveUsernamesChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventActiveUsernamesChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil")
	}
	{
		headerLen, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err)
		}

		if headerLen > 0 {
			c.OldUsernames = make([]string, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err)
			}
			c.OldUsernames = append(c.OldUsernames, value)
		}
	}
	{
		headerLen, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err)
		}

		if headerLen > 0 {
			c.NewUsernames = make([]string, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err)
			}
			c.NewUsernames = append(c.NewUsernames, value)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventActiveUsernamesChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventActiveUsernamesChanged")
	b.Comma()
	b.FieldStart("old_usernames")
	b.ArrStart()
	for _, v := range c.OldUsernames {
		b.PutString(v)
		b.Comma()
	}
	b.StripComma()
	b.ArrEnd()
	b.Comma()
	b.FieldStart("new_usernames")
	b.ArrStart()
	for _, v := range c.NewUsernames {
		b.PutString(v)
		b.Comma()
	}
	b.StripComma()
	b.ArrEnd()
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventActiveUsernamesChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventActiveUsernamesChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: %w", err)
			}
		case "old_usernames":
			if err := b.Arr(func(b tdjson.Decoder) error {
				value, err := b.String()
				if err != nil {
					return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err)
				}
				c.OldUsernames = append(c.OldUsernames, value)
				return nil
			}); err != nil {
				return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err)
			}
		case "new_usernames":
			if err := b.Arr(func(b tdjson.Decoder) error {
				value, err := b.String()
				if err != nil {
					return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err)
				}
				c.NewUsernames = append(c.NewUsernames, value)
				return nil
			}); err != nil {
				return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldUsernames returns value of OldUsernames field.
func (c *ChatEventActiveUsernamesChanged) GetOldUsernames() (value []string) {
	if c == nil {
		return
	}
	return c.OldUsernames
}

// GetNewUsernames returns value of NewUsernames field.
func (c *ChatEventActiveUsernamesChanged) GetNewUsernames() (value []string) {
	if c == nil {
		return
	}
	return c.NewUsernames
}

// ChatEventAccentColorChanged represents TL type `chatEventAccentColorChanged#e6837733`.
type ChatEventAccentColorChanged struct {
	// Previous identifier of chat accent color
	OldAccentColorID int32
	// Previous identifier of the custom emoji; 0 if none
	OldBackgroundCustomEmojiID int64
	// New identifier of chat accent color
	NewAccentColorID int32
	// New identifier of the custom emoji; 0 if none
	NewBackgroundCustomEmojiID int64
}

// ChatEventAccentColorChangedTypeID is TL type id of ChatEventAccentColorChanged.
const ChatEventAccentColorChangedTypeID = 0xe6837733

// construct implements constructor of ChatEventActionClass.
func (c ChatEventAccentColorChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventAccentColorChanged{}
)

func (c *ChatEventAccentColorChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldAccentColorID == 0) {
		return false
	}
	if !(c.OldBackgroundCustomEmojiID == 0) {
		return false
	}
	if !(c.NewAccentColorID == 0) {
		return false
	}
	if !(c.NewBackgroundCustomEmojiID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventAccentColorChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventAccentColorChanged",
		ID:   ChatEventAccentColorChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldAccentColorID",
			SchemaName: "old_accent_color_id",
		},
		{
			Name:       "OldBackgroundCustomEmojiID",
			SchemaName: "old_background_custom_emoji_id",
		},
		{
			Name:       "NewAccentColorID",
			SchemaName: "new_accent_color_id",
		},
		{
			Name:       "NewBackgroundCustomEmojiID",
			SchemaName: "new_background_custom_emoji_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventAccentColorChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil")
	}
	b.PutID(ChatEventAccentColorChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventAccentColorChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil")
	}
	b.PutInt32(c.OldAccentColorID)
	b.PutLong(c.OldBackgroundCustomEmojiID)
	b.PutInt32(c.NewAccentColorID)
	b.PutLong(c.NewBackgroundCustomEmojiID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventAccentColorChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil")
	}
	if err := b.ConsumeID(ChatEventAccentColorChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventAccentColorChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_accent_color_id: %w", err)
		}
		c.OldAccentColorID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_background_custom_emoji_id: %w", err)
		}
		c.OldBackgroundCustomEmojiID = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_accent_color_id: %w", err)
		}
		c.NewAccentColorID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_background_custom_emoji_id: %w", err)
		}
		c.NewBackgroundCustomEmojiID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventAccentColorChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventAccentColorChanged")
	b.Comma()
	b.FieldStart("old_accent_color_id")
	b.PutInt32(c.OldAccentColorID)
	b.Comma()
	b.FieldStart("old_background_custom_emoji_id")
	b.PutLong(c.OldBackgroundCustomEmojiID)
	b.Comma()
	b.FieldStart("new_accent_color_id")
	b.PutInt32(c.NewAccentColorID)
	b.Comma()
	b.FieldStart("new_background_custom_emoji_id")
	b.PutLong(c.NewBackgroundCustomEmojiID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventAccentColorChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventAccentColorChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: %w", err)
			}
		case "old_accent_color_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_accent_color_id: %w", err)
			}
			c.OldAccentColorID = value
		case "old_background_custom_emoji_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_background_custom_emoji_id: %w", err)
			}
			c.OldBackgroundCustomEmojiID = value
		case "new_accent_color_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_accent_color_id: %w", err)
			}
			c.NewAccentColorID = value
		case "new_background_custom_emoji_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_background_custom_emoji_id: %w", err)
			}
			c.NewBackgroundCustomEmojiID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldAccentColorID returns value of OldAccentColorID field.
func (c *ChatEventAccentColorChanged) GetOldAccentColorID() (value int32) {
	if c == nil {
		return
	}
	return c.OldAccentColorID
}

// GetOldBackgroundCustomEmojiID returns value of OldBackgroundCustomEmojiID field.
func (c *ChatEventAccentColorChanged) GetOldBackgroundCustomEmojiID() (value int64) {
	if c == nil {
		return
	}
	return c.OldBackgroundCustomEmojiID
}

// GetNewAccentColorID returns value of NewAccentColorID field.
func (c *ChatEventAccentColorChanged) GetNewAccentColorID() (value int32) {
	if c == nil {
		return
	}
	return c.NewAccentColorID
}

// GetNewBackgroundCustomEmojiID returns value of NewBackgroundCustomEmojiID field.
func (c *ChatEventAccentColorChanged) GetNewBackgroundCustomEmojiID() (value int64) {
	if c == nil {
		return
	}
	return c.NewBackgroundCustomEmojiID
}

// ChatEventProfileAccentColorChanged represents TL type `chatEventProfileAccentColorChanged#a5b8da64`.
type ChatEventProfileAccentColorChanged struct {
	// Previous identifier of chat's profile accent color; -1 if none
	OldProfileAccentColorID int32
	// Previous identifier of the custom emoji; 0 if none
	OldProfileBackgroundCustomEmojiID int64
	// New identifier of chat's profile accent color; -1 if none
	NewProfileAccentColorID int32
	// New identifier of the custom emoji; 0 if none
	NewProfileBackgroundCustomEmojiID int64
}

// ChatEventProfileAccentColorChangedTypeID is TL type id of ChatEventProfileAccentColorChanged.
const ChatEventProfileAccentColorChangedTypeID = 0xa5b8da64

// construct implements constructor of ChatEventActionClass.
func (c ChatEventProfileAccentColorChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventProfileAccentColorChanged{}
)

func (c *ChatEventProfileAccentColorChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldProfileAccentColorID == 0) {
		return false
	}
	if !(c.OldProfileBackgroundCustomEmojiID == 0) {
		return false
	}
	if !(c.NewProfileAccentColorID == 0) {
		return false
	}
	if !(c.NewProfileBackgroundCustomEmojiID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventProfileAccentColorChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventProfileAccentColorChanged",
		ID:   ChatEventProfileAccentColorChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldProfileAccentColorID",
			SchemaName: "old_profile_accent_color_id",
		},
		{
			Name:       "OldProfileBackgroundCustomEmojiID",
			SchemaName: "old_profile_background_custom_emoji_id",
		},
		{
			Name:       "NewProfileAccentColorID",
			SchemaName: "new_profile_accent_color_id",
		},
		{
			Name:       "NewProfileBackgroundCustomEmojiID",
			SchemaName: "new_profile_background_custom_emoji_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventProfileAccentColorChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil")
	}
	b.PutID(ChatEventProfileAccentColorChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventProfileAccentColorChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil")
	}
	b.PutInt32(c.OldProfileAccentColorID)
	b.PutLong(c.OldProfileBackgroundCustomEmojiID)
	b.PutInt32(c.NewProfileAccentColorID)
	b.PutLong(c.NewProfileBackgroundCustomEmojiID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventProfileAccentColorChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil")
	}
	if err := b.ConsumeID(ChatEventProfileAccentColorChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventProfileAccentColorChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_accent_color_id: %w", err)
		}
		c.OldProfileAccentColorID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_background_custom_emoji_id: %w", err)
		}
		c.OldProfileBackgroundCustomEmojiID = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_accent_color_id: %w", err)
		}
		c.NewProfileAccentColorID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_background_custom_emoji_id: %w", err)
		}
		c.NewProfileBackgroundCustomEmojiID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventProfileAccentColorChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventProfileAccentColorChanged")
	b.Comma()
	b.FieldStart("old_profile_accent_color_id")
	b.PutInt32(c.OldProfileAccentColorID)
	b.Comma()
	b.FieldStart("old_profile_background_custom_emoji_id")
	b.PutLong(c.OldProfileBackgroundCustomEmojiID)
	b.Comma()
	b.FieldStart("new_profile_accent_color_id")
	b.PutInt32(c.NewProfileAccentColorID)
	b.Comma()
	b.FieldStart("new_profile_background_custom_emoji_id")
	b.PutLong(c.NewProfileBackgroundCustomEmojiID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventProfileAccentColorChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventProfileAccentColorChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: %w", err)
			}
		case "old_profile_accent_color_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_accent_color_id: %w", err)
			}
			c.OldProfileAccentColorID = value
		case "old_profile_background_custom_emoji_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_background_custom_emoji_id: %w", err)
			}
			c.OldProfileBackgroundCustomEmojiID = value
		case "new_profile_accent_color_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_accent_color_id: %w", err)
			}
			c.NewProfileAccentColorID = value
		case "new_profile_background_custom_emoji_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_background_custom_emoji_id: %w", err)
			}
			c.NewProfileBackgroundCustomEmojiID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldProfileAccentColorID returns value of OldProfileAccentColorID field.
func (c *ChatEventProfileAccentColorChanged) GetOldProfileAccentColorID() (value int32) {
	if c == nil {
		return
	}
	return c.OldProfileAccentColorID
}

// GetOldProfileBackgroundCustomEmojiID returns value of OldProfileBackgroundCustomEmojiID field.
func (c *ChatEventProfileAccentColorChanged) GetOldProfileBackgroundCustomEmojiID() (value int64) {
	if c == nil {
		return
	}
	return c.OldProfileBackgroundCustomEmojiID
}

// GetNewProfileAccentColorID returns value of NewProfileAccentColorID field.
func (c *ChatEventProfileAccentColorChanged) GetNewProfileAccentColorID() (value int32) {
	if c == nil {
		return
	}
	return c.NewProfileAccentColorID
}

// GetNewProfileBackgroundCustomEmojiID returns value of NewProfileBackgroundCustomEmojiID field.
func (c *ChatEventProfileAccentColorChanged) GetNewProfileBackgroundCustomEmojiID() (value int64) {
	if c == nil {
		return
	}
	return c.NewProfileBackgroundCustomEmojiID
}

// ChatEventHasProtectedContentToggled represents TL type `chatEventHasProtectedContentToggled#f5044201`.
type ChatEventHasProtectedContentToggled struct {
	// New value of has_protected_content
	HasProtectedContent bool
}

// ChatEventHasProtectedContentToggledTypeID is TL type id of ChatEventHasProtectedContentToggled.
const ChatEventHasProtectedContentToggledTypeID = 0xf5044201

// construct implements constructor of ChatEventActionClass.
func (c ChatEventHasProtectedContentToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventHasProtectedContentToggled{}
)

func (c *ChatEventHasProtectedContentToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.HasProtectedContent == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventHasProtectedContentToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventHasProtectedContentToggled",
		ID:   ChatEventHasProtectedContentToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "HasProtectedContent",
			SchemaName: "has_protected_content",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventHasProtectedContentToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil")
	}
	b.PutID(ChatEventHasProtectedContentToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventHasProtectedContentToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil")
	}
	b.PutBool(c.HasProtectedContent)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventHasProtectedContentToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil")
	}
	if err := b.ConsumeID(ChatEventHasProtectedContentToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventHasProtectedContentToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err)
		}
		c.HasProtectedContent = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventHasProtectedContentToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventHasProtectedContentToggled")
	b.Comma()
	b.FieldStart("has_protected_content")
	b.PutBool(c.HasProtectedContent)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventHasProtectedContentToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventHasProtectedContentToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err)
			}
		case "has_protected_content":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err)
			}
			c.HasProtectedContent = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetHasProtectedContent returns value of HasProtectedContent field.
func (c *ChatEventHasProtectedContentToggled) GetHasProtectedContent() (value bool) {
	if c == nil {
		return
	}
	return c.HasProtectedContent
}

// ChatEventInvitesToggled represents TL type `chatEventInvitesToggled#fc45966b`.
type ChatEventInvitesToggled struct {
	// New value of can_invite_users permission
	CanInviteUsers bool
}

// ChatEventInvitesToggledTypeID is TL type id of ChatEventInvitesToggled.
const ChatEventInvitesToggledTypeID = 0xfc45966b

// construct implements constructor of ChatEventActionClass.
func (c ChatEventInvitesToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventInvitesToggled{}
)

func (c *ChatEventInvitesToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.CanInviteUsers == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventInvitesToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventInvitesToggled",
		ID:   ChatEventInvitesToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "CanInviteUsers",
			SchemaName: "can_invite_users",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventInvitesToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil")
	}
	b.PutID(ChatEventInvitesToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventInvitesToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil")
	}
	b.PutBool(c.CanInviteUsers)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventInvitesToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil")
	}
	if err := b.ConsumeID(ChatEventInvitesToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventInvitesToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err)
		}
		c.CanInviteUsers = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventInvitesToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil")
	}
	b.ObjStart()
	b.PutID("chatEventInvitesToggled")
	b.Comma()
	b.FieldStart("can_invite_users")
	b.PutBool(c.CanInviteUsers)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventInvitesToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventInvitesToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err)
			}
		case "can_invite_users":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err)
			}
			c.CanInviteUsers = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetCanInviteUsers returns value of CanInviteUsers field.
func (c *ChatEventInvitesToggled) GetCanInviteUsers() (value bool) {
	if c == nil {
		return
	}
	return c.CanInviteUsers
}

// ChatEventIsAllHistoryAvailableToggled represents TL type `chatEventIsAllHistoryAvailableToggled#a0b03c15`.
type ChatEventIsAllHistoryAvailableToggled struct {
	// New value of is_all_history_available
	IsAllHistoryAvailable bool
}

// ChatEventIsAllHistoryAvailableToggledTypeID is TL type id of ChatEventIsAllHistoryAvailableToggled.
const ChatEventIsAllHistoryAvailableToggledTypeID = 0xa0b03c15

// construct implements constructor of ChatEventActionClass.
func (c ChatEventIsAllHistoryAvailableToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventIsAllHistoryAvailableToggled{}
)

func (c *ChatEventIsAllHistoryAvailableToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.IsAllHistoryAvailable == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventIsAllHistoryAvailableToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventIsAllHistoryAvailableToggled",
		ID:   ChatEventIsAllHistoryAvailableToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsAllHistoryAvailable",
			SchemaName: "is_all_history_available",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventIsAllHistoryAvailableToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil")
	}
	b.PutID(ChatEventIsAllHistoryAvailableToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventIsAllHistoryAvailableToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil")
	}
	b.PutBool(c.IsAllHistoryAvailable)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventIsAllHistoryAvailableToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil")
	}
	if err := b.ConsumeID(ChatEventIsAllHistoryAvailableToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventIsAllHistoryAvailableToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err)
		}
		c.IsAllHistoryAvailable = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventIsAllHistoryAvailableToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventIsAllHistoryAvailableToggled")
	b.Comma()
	b.FieldStart("is_all_history_available")
	b.PutBool(c.IsAllHistoryAvailable)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventIsAllHistoryAvailableToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventIsAllHistoryAvailableToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err)
			}
		case "is_all_history_available":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err)
			}
			c.IsAllHistoryAvailable = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field.
func (c *ChatEventIsAllHistoryAvailableToggled) GetIsAllHistoryAvailable() (value bool) {
	if c == nil {
		return
	}
	return c.IsAllHistoryAvailable
}

// ChatEventHasAggressiveAntiSpamEnabledToggled represents TL type `chatEventHasAggressiveAntiSpamEnabledToggled#f8875702`.
type ChatEventHasAggressiveAntiSpamEnabledToggled struct {
	// New value of has_aggressive_anti_spam_enabled
	HasAggressiveAntiSpamEnabled bool
}

// ChatEventHasAggressiveAntiSpamEnabledToggledTypeID is TL type id of ChatEventHasAggressiveAntiSpamEnabledToggled.
const ChatEventHasAggressiveAntiSpamEnabledToggledTypeID = 0xf8875702

// construct implements constructor of ChatEventActionClass.
func (c ChatEventHasAggressiveAntiSpamEnabledToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventHasAggressiveAntiSpamEnabledToggled{}
)

func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.HasAggressiveAntiSpamEnabled == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventHasAggressiveAntiSpamEnabledToggled",
		ID:   ChatEventHasAggressiveAntiSpamEnabledToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "HasAggressiveAntiSpamEnabled",
			SchemaName: "has_aggressive_anti_spam_enabled",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil")
	}
	b.PutID(ChatEventHasAggressiveAntiSpamEnabledToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil")
	}
	b.PutBool(c.HasAggressiveAntiSpamEnabled)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil")
	}
	if err := b.ConsumeID(ChatEventHasAggressiveAntiSpamEnabledToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: field has_aggressive_anti_spam_enabled: %w", err)
		}
		c.HasAggressiveAntiSpamEnabled = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventHasAggressiveAntiSpamEnabledToggled")
	b.Comma()
	b.FieldStart("has_aggressive_anti_spam_enabled")
	b.PutBool(c.HasAggressiveAntiSpamEnabled)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventHasAggressiveAntiSpamEnabledToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: %w", err)
			}
		case "has_aggressive_anti_spam_enabled":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: field has_aggressive_anti_spam_enabled: %w", err)
			}
			c.HasAggressiveAntiSpamEnabled = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetHasAggressiveAntiSpamEnabled returns value of HasAggressiveAntiSpamEnabled field.
func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) GetHasAggressiveAntiSpamEnabled() (value bool) {
	if c == nil {
		return
	}
	return c.HasAggressiveAntiSpamEnabled
}

// ChatEventSignMessagesToggled represents TL type `chatEventSignMessagesToggled#b1b9281e`.
type ChatEventSignMessagesToggled struct {
	// New value of sign_messages
	SignMessages bool
}

// ChatEventSignMessagesToggledTypeID is TL type id of ChatEventSignMessagesToggled.
const ChatEventSignMessagesToggledTypeID = 0xb1b9281e

// construct implements constructor of ChatEventActionClass.
func (c ChatEventSignMessagesToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventSignMessagesToggled{}
)

func (c *ChatEventSignMessagesToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.SignMessages == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventSignMessagesToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventSignMessagesToggled",
		ID:   ChatEventSignMessagesToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "SignMessages",
			SchemaName: "sign_messages",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventSignMessagesToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil")
	}
	b.PutID(ChatEventSignMessagesToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventSignMessagesToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil")
	}
	b.PutBool(c.SignMessages)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventSignMessagesToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil")
	}
	if err := b.ConsumeID(ChatEventSignMessagesToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventSignMessagesToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err)
		}
		c.SignMessages = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventSignMessagesToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil")
	}
	b.ObjStart()
	b.PutID("chatEventSignMessagesToggled")
	b.Comma()
	b.FieldStart("sign_messages")
	b.PutBool(c.SignMessages)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventSignMessagesToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventSignMessagesToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err)
			}
		case "sign_messages":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err)
			}
			c.SignMessages = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetSignMessages returns value of SignMessages field.
func (c *ChatEventSignMessagesToggled) GetSignMessages() (value bool) {
	if c == nil {
		return
	}
	return c.SignMessages
}

// ChatEventShowMessageSenderToggled represents TL type `chatEventShowMessageSenderToggled#d0a747e3`.
type ChatEventShowMessageSenderToggled struct {
	// New value of show_message_sender
	ShowMessageSender bool
}

// ChatEventShowMessageSenderToggledTypeID is TL type id of ChatEventShowMessageSenderToggled.
const ChatEventShowMessageSenderToggledTypeID = 0xd0a747e3

// construct implements constructor of ChatEventActionClass.
func (c ChatEventShowMessageSenderToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventShowMessageSenderToggled{}
)

func (c *ChatEventShowMessageSenderToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.ShowMessageSender == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventShowMessageSenderToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventShowMessageSenderToggled",
		ID:   ChatEventShowMessageSenderToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ShowMessageSender",
			SchemaName: "show_message_sender",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventShowMessageSenderToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil")
	}
	b.PutID(ChatEventShowMessageSenderToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventShowMessageSenderToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil")
	}
	b.PutBool(c.ShowMessageSender)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventShowMessageSenderToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil")
	}
	if err := b.ConsumeID(ChatEventShowMessageSenderToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventShowMessageSenderToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: field show_message_sender: %w", err)
		}
		c.ShowMessageSender = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventShowMessageSenderToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventShowMessageSenderToggled")
	b.Comma()
	b.FieldStart("show_message_sender")
	b.PutBool(c.ShowMessageSender)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventShowMessageSenderToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventShowMessageSenderToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: %w", err)
			}
		case "show_message_sender":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: field show_message_sender: %w", err)
			}
			c.ShowMessageSender = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetShowMessageSender returns value of ShowMessageSender field.
func (c *ChatEventShowMessageSenderToggled) GetShowMessageSender() (value bool) {
	if c == nil {
		return
	}
	return c.ShowMessageSender
}

// ChatEventAutomaticTranslationToggled represents TL type `chatEventAutomaticTranslationToggled#b927656`.
type ChatEventAutomaticTranslationToggled struct {
	// New value of has_automatic_translation
	HasAutomaticTranslation bool
}

// ChatEventAutomaticTranslationToggledTypeID is TL type id of ChatEventAutomaticTranslationToggled.
const ChatEventAutomaticTranslationToggledTypeID = 0xb927656

// construct implements constructor of ChatEventActionClass.
func (c ChatEventAutomaticTranslationToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventAutomaticTranslationToggled{}
)

func (c *ChatEventAutomaticTranslationToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.HasAutomaticTranslation == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventAutomaticTranslationToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventAutomaticTranslationToggled",
		ID:   ChatEventAutomaticTranslationToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "HasAutomaticTranslation",
			SchemaName: "has_automatic_translation",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventAutomaticTranslationToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAutomaticTranslationToggled#b927656 as nil")
	}
	b.PutID(ChatEventAutomaticTranslationToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventAutomaticTranslationToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAutomaticTranslationToggled#b927656 as nil")
	}
	b.PutBool(c.HasAutomaticTranslation)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventAutomaticTranslationToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAutomaticTranslationToggled#b927656 to nil")
	}
	if err := b.ConsumeID(ChatEventAutomaticTranslationToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventAutomaticTranslationToggled#b927656: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventAutomaticTranslationToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAutomaticTranslationToggled#b927656 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventAutomaticTranslationToggled#b927656: field has_automatic_translation: %w", err)
		}
		c.HasAutomaticTranslation = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventAutomaticTranslationToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventAutomaticTranslationToggled#b927656 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventAutomaticTranslationToggled")
	b.Comma()
	b.FieldStart("has_automatic_translation")
	b.PutBool(c.HasAutomaticTranslation)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventAutomaticTranslationToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventAutomaticTranslationToggled#b927656 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventAutomaticTranslationToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventAutomaticTranslationToggled#b927656: %w", err)
			}
		case "has_automatic_translation":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventAutomaticTranslationToggled#b927656: field has_automatic_translation: %w", err)
			}
			c.HasAutomaticTranslation = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetHasAutomaticTranslation returns value of HasAutomaticTranslation field.
func (c *ChatEventAutomaticTranslationToggled) GetHasAutomaticTranslation() (value bool) {
	if c == nil {
		return
	}
	return c.HasAutomaticTranslation
}

// ChatEventInviteLinkEdited represents TL type `chatEventInviteLinkEdited#e4920d62`.
type ChatEventInviteLinkEdited struct {
	// Previous information about the invite link
	OldInviteLink ChatInviteLink
	// New information about the invite link
	NewInviteLink ChatInviteLink
}

// ChatEventInviteLinkEditedTypeID is TL type id of ChatEventInviteLinkEdited.
const ChatEventInviteLinkEditedTypeID = 0xe4920d62

// construct implements constructor of ChatEventActionClass.
func (c ChatEventInviteLinkEdited) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventInviteLinkEdited{}
)

func (c *ChatEventInviteLinkEdited) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldInviteLink.Zero()) {
		return false
	}
	if !(c.NewInviteLink.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventInviteLinkEdited) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventInviteLinkEdited",
		ID:   ChatEventInviteLinkEditedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldInviteLink",
			SchemaName: "old_invite_link",
		},
		{
			Name:       "NewInviteLink",
			SchemaName: "new_invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventInviteLinkEdited) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil")
	}
	b.PutID(ChatEventInviteLinkEditedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventInviteLinkEdited) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil")
	}
	if err := c.OldInviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err)
	}
	if err := c.NewInviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventInviteLinkEdited) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil")
	}
	if err := b.ConsumeID(ChatEventInviteLinkEditedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventInviteLinkEdited) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil")
	}
	{
		if err := c.OldInviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err)
		}
	}
	{
		if err := c.NewInviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventInviteLinkEdited) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventInviteLinkEdited")
	b.Comma()
	b.FieldStart("old_invite_link")
	if err := c.OldInviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err)
	}
	b.Comma()
	b.FieldStart("new_invite_link")
	if err := c.NewInviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventInviteLinkEdited) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventInviteLinkEdited"); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: %w", err)
			}
		case "old_invite_link":
			if err := c.OldInviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err)
			}
		case "new_invite_link":
			if err := c.NewInviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldInviteLink returns value of OldInviteLink field.
func (c *ChatEventInviteLinkEdited) GetOldInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.OldInviteLink
}

// GetNewInviteLink returns value of NewInviteLink field.
func (c *ChatEventInviteLinkEdited) GetNewInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.NewInviteLink
}

// ChatEventInviteLinkRevoked represents TL type `chatEventInviteLinkRevoked#a1dbffe3`.
type ChatEventInviteLinkRevoked struct {
	// The invite link
	InviteLink ChatInviteLink
}

// ChatEventInviteLinkRevokedTypeID is TL type id of ChatEventInviteLinkRevoked.
const ChatEventInviteLinkRevokedTypeID = 0xa1dbffe3

// construct implements constructor of ChatEventActionClass.
func (c ChatEventInviteLinkRevoked) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventInviteLinkRevoked{}
)

func (c *ChatEventInviteLinkRevoked) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.InviteLink.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventInviteLinkRevoked) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventInviteLinkRevoked",
		ID:   ChatEventInviteLinkRevokedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventInviteLinkRevoked) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil")
	}
	b.PutID(ChatEventInviteLinkRevokedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventInviteLinkRevoked) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil")
	}
	if err := c.InviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventInviteLinkRevoked) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil")
	}
	if err := b.ConsumeID(ChatEventInviteLinkRevokedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventInviteLinkRevoked) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil")
	}
	{
		if err := c.InviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventInviteLinkRevoked) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventInviteLinkRevoked")
	b.Comma()
	b.FieldStart("invite_link")
	if err := c.InviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventInviteLinkRevoked) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventInviteLinkRevoked"); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: %w", err)
			}
		case "invite_link":
			if err := c.InviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (c *ChatEventInviteLinkRevoked) GetInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.InviteLink
}

// ChatEventInviteLinkDeleted represents TL type `chatEventInviteLinkDeleted#acda6167`.
type ChatEventInviteLinkDeleted struct {
	// The invite link
	InviteLink ChatInviteLink
}

// ChatEventInviteLinkDeletedTypeID is TL type id of ChatEventInviteLinkDeleted.
const ChatEventInviteLinkDeletedTypeID = 0xacda6167

// construct implements constructor of ChatEventActionClass.
func (c ChatEventInviteLinkDeleted) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventInviteLinkDeleted{}
)

func (c *ChatEventInviteLinkDeleted) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.InviteLink.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventInviteLinkDeleted) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventInviteLinkDeleted",
		ID:   ChatEventInviteLinkDeletedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventInviteLinkDeleted) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil")
	}
	b.PutID(ChatEventInviteLinkDeletedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventInviteLinkDeleted) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil")
	}
	if err := c.InviteLink.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventInviteLinkDeleted) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil")
	}
	if err := b.ConsumeID(ChatEventInviteLinkDeletedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventInviteLinkDeleted) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil")
	}
	{
		if err := c.InviteLink.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventInviteLinkDeleted) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventInviteLinkDeleted")
	b.Comma()
	b.FieldStart("invite_link")
	if err := c.InviteLink.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventInviteLinkDeleted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventInviteLinkDeleted"); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: %w", err)
			}
		case "invite_link":
			if err := c.InviteLink.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (c *ChatEventInviteLinkDeleted) GetInviteLink() (value ChatInviteLink) {
	if c == nil {
		return
	}
	return c.InviteLink
}

// ChatEventVideoChatCreated represents TL type `chatEventVideoChatCreated#6ca68a7b`.
type ChatEventVideoChatCreated struct {
	// Identifier of the video chat. The video chat can be received through the method
	// getGroupCall
	GroupCallID int32
}

// ChatEventVideoChatCreatedTypeID is TL type id of ChatEventVideoChatCreated.
const ChatEventVideoChatCreatedTypeID = 0x6ca68a7b

// construct implements constructor of ChatEventActionClass.
func (c ChatEventVideoChatCreated) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventVideoChatCreated{}
)

func (c *ChatEventVideoChatCreated) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.GroupCallID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventVideoChatCreated) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventVideoChatCreated",
		ID:   ChatEventVideoChatCreatedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "GroupCallID",
			SchemaName: "group_call_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventVideoChatCreated) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil")
	}
	b.PutID(ChatEventVideoChatCreatedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventVideoChatCreated) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil")
	}
	b.PutInt32(c.GroupCallID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventVideoChatCreated) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil")
	}
	if err := b.ConsumeID(ChatEventVideoChatCreatedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventVideoChatCreated) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: field group_call_id: %w", err)
		}
		c.GroupCallID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventVideoChatCreated) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil")
	}
	b.ObjStart()
	b.PutID("chatEventVideoChatCreated")
	b.Comma()
	b.FieldStart("group_call_id")
	b.PutInt32(c.GroupCallID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventVideoChatCreated) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventVideoChatCreated"); err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: %w", err)
			}
		case "group_call_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: field group_call_id: %w", err)
			}
			c.GroupCallID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetGroupCallID returns value of GroupCallID field.
func (c *ChatEventVideoChatCreated) GetGroupCallID() (value int32) {
	if c == nil {
		return
	}
	return c.GroupCallID
}

// ChatEventVideoChatEnded represents TL type `chatEventVideoChatEnded#61286c48`.
type ChatEventVideoChatEnded struct {
	// Identifier of the video chat. The video chat can be received through the method
	// getGroupCall
	GroupCallID int32
}

// ChatEventVideoChatEndedTypeID is TL type id of ChatEventVideoChatEnded.
const ChatEventVideoChatEndedTypeID = 0x61286c48

// construct implements constructor of ChatEventActionClass.
func (c ChatEventVideoChatEnded) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventVideoChatEnded{}
)

func (c *ChatEventVideoChatEnded) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.GroupCallID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventVideoChatEnded) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventVideoChatEnded",
		ID:   ChatEventVideoChatEndedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "GroupCallID",
			SchemaName: "group_call_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventVideoChatEnded) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil")
	}
	b.PutID(ChatEventVideoChatEndedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventVideoChatEnded) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil")
	}
	b.PutInt32(c.GroupCallID)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventVideoChatEnded) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil")
	}
	if err := b.ConsumeID(ChatEventVideoChatEndedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventVideoChatEnded) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err)
		}
		c.GroupCallID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventVideoChatEnded")
	b.Comma()
	b.FieldStart("group_call_id")
	b.PutInt32(c.GroupCallID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventVideoChatEnded"); err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err)
			}
		case "group_call_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err)
			}
			c.GroupCallID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetGroupCallID returns value of GroupCallID field.
func (c *ChatEventVideoChatEnded) GetGroupCallID() (value int32) {
	if c == nil {
		return
	}
	return c.GroupCallID
}

// ChatEventVideoChatMuteNewParticipantsToggled represents TL type `chatEventVideoChatMuteNewParticipantsToggled#f87507fe`.
type ChatEventVideoChatMuteNewParticipantsToggled struct {
	// New value of the mute_new_participants setting
	MuteNewParticipants bool
}

// ChatEventVideoChatMuteNewParticipantsToggledTypeID is TL type id of ChatEventVideoChatMuteNewParticipantsToggled.
const ChatEventVideoChatMuteNewParticipantsToggledTypeID = 0xf87507fe

// construct implements constructor of ChatEventActionClass.
func (c ChatEventVideoChatMuteNewParticipantsToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventVideoChatMuteNewParticipantsToggled{}
)

func (c *ChatEventVideoChatMuteNewParticipantsToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.MuteNewParticipants == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventVideoChatMuteNewParticipantsToggled",
		ID:   ChatEventVideoChatMuteNewParticipantsToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MuteNewParticipants",
			SchemaName: "mute_new_participants",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil")
	}
	b.PutID(ChatEventVideoChatMuteNewParticipantsToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil")
	}
	b.PutBool(c.MuteNewParticipants)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil")
	}
	if err := b.ConsumeID(ChatEventVideoChatMuteNewParticipantsToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err)
		}
		c.MuteNewParticipants = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil")
	}
	b.ObjStart()
	b.PutID("chatEventVideoChatMuteNewParticipantsToggled")
	b.Comma()
	b.FieldStart("mute_new_participants")
	b.PutBool(c.MuteNewParticipants)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventVideoChatMuteNewParticipantsToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err)
			}
		case "mute_new_participants":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err)
			}
			c.MuteNewParticipants = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMuteNewParticipants returns value of MuteNewParticipants field.
func (c *ChatEventVideoChatMuteNewParticipantsToggled) GetMuteNewParticipants() (value bool) {
	if c == nil {
		return
	}
	return c.MuteNewParticipants
}

// ChatEventVideoChatParticipantIsMutedToggled represents TL type `chatEventVideoChatParticipantIsMutedToggled#1f1058f7`.
type ChatEventVideoChatParticipantIsMutedToggled struct {
	// Identifier of the affected group call participant
	ParticipantID MessageSenderClass
	// New value of is_muted
	IsMuted bool
}

// ChatEventVideoChatParticipantIsMutedToggledTypeID is TL type id of ChatEventVideoChatParticipantIsMutedToggled.
const ChatEventVideoChatParticipantIsMutedToggledTypeID = 0x1f1058f7

// construct implements constructor of ChatEventActionClass.
func (c ChatEventVideoChatParticipantIsMutedToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventVideoChatParticipantIsMutedToggled{}
)

func (c *ChatEventVideoChatParticipantIsMutedToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.ParticipantID == nil) {
		return false
	}
	if !(c.IsMuted == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventVideoChatParticipantIsMutedToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventVideoChatParticipantIsMutedToggled",
		ID:   ChatEventVideoChatParticipantIsMutedToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ParticipantID",
			SchemaName: "participant_id",
		},
		{
			Name:       "IsMuted",
			SchemaName: "is_muted",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil")
	}
	b.PutID(ChatEventVideoChatParticipantIsMutedToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil")
	}
	if c.ParticipantID == nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id is nil")
	}
	if err := c.ParticipantID.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err)
	}
	b.PutBool(c.IsMuted)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil")
	}
	if err := b.ConsumeID(ChatEventVideoChatParticipantIsMutedToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil")
	}
	{
		value, err := DecodeMessageSender(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err)
		}
		c.ParticipantID = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field is_muted: %w", err)
		}
		c.IsMuted = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventVideoChatParticipantIsMutedToggled")
	b.Comma()
	b.FieldStart("participant_id")
	if c.ParticipantID == nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id is nil")
	}
	if err := c.ParticipantID.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err)
	}
	b.Comma()
	b.FieldStart("is_muted")
	b.PutBool(c.IsMuted)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventVideoChatParticipantIsMutedToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventVideoChatParticipantIsMutedToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: %w", err)
			}
		case "participant_id":
			value, err := DecodeTDLibJSONMessageSender(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err)
			}
			c.ParticipantID = value
		case "is_muted":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field is_muted: %w", err)
			}
			c.IsMuted = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetParticipantID returns value of ParticipantID field.
func (c *ChatEventVideoChatParticipantIsMutedToggled) GetParticipantID() (value MessageSenderClass) {
	if c == nil {
		return
	}
	return c.ParticipantID
}

// GetIsMuted returns value of IsMuted field.
func (c *ChatEventVideoChatParticipantIsMutedToggled) GetIsMuted() (value bool) {
	if c == nil {
		return
	}
	return c.IsMuted
}

// ChatEventVideoChatParticipantVolumeLevelChanged represents TL type `chatEventVideoChatParticipantVolumeLevelChanged#436f92be`.
type ChatEventVideoChatParticipantVolumeLevelChanged struct {
	// Identifier of the affected group call participant
	ParticipantID MessageSenderClass
	// New value of volume_level; 1-20000 in hundreds of percents
	VolumeLevel int32
}

// ChatEventVideoChatParticipantVolumeLevelChangedTypeID is TL type id of ChatEventVideoChatParticipantVolumeLevelChanged.
const ChatEventVideoChatParticipantVolumeLevelChangedTypeID = 0x436f92be

// construct implements constructor of ChatEventActionClass.
func (c ChatEventVideoChatParticipantVolumeLevelChanged) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventVideoChatParticipantVolumeLevelChanged{}
)

func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.ParticipantID == nil) {
		return false
	}
	if !(c.VolumeLevel == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventVideoChatParticipantVolumeLevelChanged",
		ID:   ChatEventVideoChatParticipantVolumeLevelChangedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ParticipantID",
			SchemaName: "participant_id",
		},
		{
			Name:       "VolumeLevel",
			SchemaName: "volume_level",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil")
	}
	b.PutID(ChatEventVideoChatParticipantVolumeLevelChangedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil")
	}
	if c.ParticipantID == nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id is nil")
	}
	if err := c.ParticipantID.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err)
	}
	b.PutInt32(c.VolumeLevel)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil")
	}
	if err := b.ConsumeID(ChatEventVideoChatParticipantVolumeLevelChangedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil")
	}
	{
		value, err := DecodeMessageSender(b)
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err)
		}
		c.ParticipantID = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field volume_level: %w", err)
		}
		c.VolumeLevel = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil")
	}
	b.ObjStart()
	b.PutID("chatEventVideoChatParticipantVolumeLevelChanged")
	b.Comma()
	b.FieldStart("participant_id")
	if c.ParticipantID == nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id is nil")
	}
	if err := c.ParticipantID.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err)
	}
	b.Comma()
	b.FieldStart("volume_level")
	b.PutInt32(c.VolumeLevel)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventVideoChatParticipantVolumeLevelChanged"); err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: %w", err)
			}
		case "participant_id":
			value, err := DecodeTDLibJSONMessageSender(b)
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err)
			}
			c.ParticipantID = value
		case "volume_level":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field volume_level: %w", err)
			}
			c.VolumeLevel = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetParticipantID returns value of ParticipantID field.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) GetParticipantID() (value MessageSenderClass) {
	if c == nil {
		return
	}
	return c.ParticipantID
}

// GetVolumeLevel returns value of VolumeLevel field.
func (c *ChatEventVideoChatParticipantVolumeLevelChanged) GetVolumeLevel() (value int32) {
	if c == nil {
		return
	}
	return c.VolumeLevel
}

// ChatEventIsForumToggled represents TL type `chatEventIsForumToggled#5a63d119`.
type ChatEventIsForumToggled struct {
	// New value of is_forum
	IsForum bool
}

// ChatEventIsForumToggledTypeID is TL type id of ChatEventIsForumToggled.
const ChatEventIsForumToggledTypeID = 0x5a63d119

// construct implements constructor of ChatEventActionClass.
func (c ChatEventIsForumToggled) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventIsForumToggled{}
)

func (c *ChatEventIsForumToggled) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.IsForum == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventIsForumToggled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventIsForumToggled",
		ID:   ChatEventIsForumToggledTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsForum",
			SchemaName: "is_forum",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventIsForumToggled) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil")
	}
	b.PutID(ChatEventIsForumToggledTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventIsForumToggled) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil")
	}
	b.PutBool(c.IsForum)
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventIsForumToggled) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil")
	}
	if err := b.ConsumeID(ChatEventIsForumToggledTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventIsForumToggled) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: field is_forum: %w", err)
		}
		c.IsForum = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventIsForumToggled) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventIsForumToggled")
	b.Comma()
	b.FieldStart("is_forum")
	b.PutBool(c.IsForum)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventIsForumToggled) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventIsForumToggled"); err != nil {
				return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: %w", err)
			}
		case "is_forum":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: field is_forum: %w", err)
			}
			c.IsForum = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsForum returns value of IsForum field.
func (c *ChatEventIsForumToggled) GetIsForum() (value bool) {
	if c == nil {
		return
	}
	return c.IsForum
}

// ChatEventForumTopicCreated represents TL type `chatEventForumTopicCreated#7785fb42`.
type ChatEventForumTopicCreated struct {
	// Information about the topic
	TopicInfo ForumTopicInfo
}

// ChatEventForumTopicCreatedTypeID is TL type id of ChatEventForumTopicCreated.
const ChatEventForumTopicCreatedTypeID = 0x7785fb42

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicCreated) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicCreated{}
)

func (c *ChatEventForumTopicCreated) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.TopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicCreated) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicCreated",
		ID:   ChatEventForumTopicCreatedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TopicInfo",
			SchemaName: "topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicCreated) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil")
	}
	b.PutID(ChatEventForumTopicCreatedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicCreated) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil")
	}
	if err := c.TopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicCreated) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicCreatedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicCreated) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil")
	}
	{
		if err := c.TopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicCreated) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicCreated")
	b.Comma()
	b.FieldStart("topic_info")
	if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicCreated) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicCreated"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: %w", err)
			}
		case "topic_info":
			if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTopicInfo returns value of TopicInfo field.
func (c *ChatEventForumTopicCreated) GetTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.TopicInfo
}

// ChatEventForumTopicEdited represents TL type `chatEventForumTopicEdited#60da2c0c`.
type ChatEventForumTopicEdited struct {
	// Old information about the topic
	OldTopicInfo ForumTopicInfo
	// New information about the topic
	NewTopicInfo ForumTopicInfo
}

// ChatEventForumTopicEditedTypeID is TL type id of ChatEventForumTopicEdited.
const ChatEventForumTopicEditedTypeID = 0x60da2c0c

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicEdited) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicEdited{}
)

func (c *ChatEventForumTopicEdited) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldTopicInfo.Zero()) {
		return false
	}
	if !(c.NewTopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicEdited) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicEdited",
		ID:   ChatEventForumTopicEditedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldTopicInfo",
			SchemaName: "old_topic_info",
		},
		{
			Name:       "NewTopicInfo",
			SchemaName: "new_topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicEdited) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil")
	}
	b.PutID(ChatEventForumTopicEditedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicEdited) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil")
	}
	if err := c.OldTopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err)
	}
	if err := c.NewTopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicEdited) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicEditedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicEdited) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil")
	}
	{
		if err := c.OldTopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err)
		}
	}
	{
		if err := c.NewTopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicEdited) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicEdited")
	b.Comma()
	b.FieldStart("old_topic_info")
	if err := c.OldTopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err)
	}
	b.Comma()
	b.FieldStart("new_topic_info")
	if err := c.NewTopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicEdited) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicEdited"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: %w", err)
			}
		case "old_topic_info":
			if err := c.OldTopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err)
			}
		case "new_topic_info":
			if err := c.NewTopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldTopicInfo returns value of OldTopicInfo field.
func (c *ChatEventForumTopicEdited) GetOldTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.OldTopicInfo
}

// GetNewTopicInfo returns value of NewTopicInfo field.
func (c *ChatEventForumTopicEdited) GetNewTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.NewTopicInfo
}

// ChatEventForumTopicToggleIsClosed represents TL type `chatEventForumTopicToggleIsClosed#c69e4d3a`.
type ChatEventForumTopicToggleIsClosed struct {
	// New information about the topic
	TopicInfo ForumTopicInfo
}

// ChatEventForumTopicToggleIsClosedTypeID is TL type id of ChatEventForumTopicToggleIsClosed.
const ChatEventForumTopicToggleIsClosedTypeID = 0xc69e4d3a

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicToggleIsClosed) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicToggleIsClosed{}
)

func (c *ChatEventForumTopicToggleIsClosed) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.TopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicToggleIsClosed) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicToggleIsClosed",
		ID:   ChatEventForumTopicToggleIsClosedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TopicInfo",
			SchemaName: "topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicToggleIsClosed) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil")
	}
	b.PutID(ChatEventForumTopicToggleIsClosedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicToggleIsClosed) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil")
	}
	if err := c.TopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicToggleIsClosed) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicToggleIsClosedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicToggleIsClosed) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil")
	}
	{
		if err := c.TopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicToggleIsClosed) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicToggleIsClosed")
	b.Comma()
	b.FieldStart("topic_info")
	if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicToggleIsClosed) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicToggleIsClosed"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: %w", err)
			}
		case "topic_info":
			if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTopicInfo returns value of TopicInfo field.
func (c *ChatEventForumTopicToggleIsClosed) GetTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.TopicInfo
}

// ChatEventForumTopicToggleIsHidden represents TL type `chatEventForumTopicToggleIsHidden#a015ef2e`.
type ChatEventForumTopicToggleIsHidden struct {
	// New information about the topic
	TopicInfo ForumTopicInfo
}

// ChatEventForumTopicToggleIsHiddenTypeID is TL type id of ChatEventForumTopicToggleIsHidden.
const ChatEventForumTopicToggleIsHiddenTypeID = 0xa015ef2e

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicToggleIsHidden) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicToggleIsHidden{}
)

func (c *ChatEventForumTopicToggleIsHidden) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.TopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicToggleIsHidden) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicToggleIsHidden",
		ID:   ChatEventForumTopicToggleIsHiddenTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TopicInfo",
			SchemaName: "topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicToggleIsHidden) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil")
	}
	b.PutID(ChatEventForumTopicToggleIsHiddenTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicToggleIsHidden) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil")
	}
	if err := c.TopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicToggleIsHidden) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicToggleIsHiddenTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicToggleIsHidden) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil")
	}
	{
		if err := c.TopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicToggleIsHidden) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicToggleIsHidden")
	b.Comma()
	b.FieldStart("topic_info")
	if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicToggleIsHidden) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicToggleIsHidden"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err)
			}
		case "topic_info":
			if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTopicInfo returns value of TopicInfo field.
func (c *ChatEventForumTopicToggleIsHidden) GetTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.TopicInfo
}

// ChatEventForumTopicDeleted represents TL type `chatEventForumTopicDeleted#b08f290d`.
type ChatEventForumTopicDeleted struct {
	// Information about the topic
	TopicInfo ForumTopicInfo
}

// ChatEventForumTopicDeletedTypeID is TL type id of ChatEventForumTopicDeleted.
const ChatEventForumTopicDeletedTypeID = 0xb08f290d

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicDeleted) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicDeleted{}
)

func (c *ChatEventForumTopicDeleted) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.TopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicDeleted) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicDeleted",
		ID:   ChatEventForumTopicDeletedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TopicInfo",
			SchemaName: "topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicDeleted) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil")
	}
	b.PutID(ChatEventForumTopicDeletedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicDeleted) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil")
	}
	if err := c.TopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicDeleted) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicDeletedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicDeleted) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil")
	}
	{
		if err := c.TopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicDeleted) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicDeleted")
	b.Comma()
	b.FieldStart("topic_info")
	if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicDeleted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicDeleted"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: %w", err)
			}
		case "topic_info":
			if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTopicInfo returns value of TopicInfo field.
func (c *ChatEventForumTopicDeleted) GetTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.TopicInfo
}

// ChatEventForumTopicPinned represents TL type `chatEventForumTopicPinned#7fc523ee`.
type ChatEventForumTopicPinned struct {
	// Information about the old pinned topic; may be null
	OldTopicInfo ForumTopicInfo
	// Information about the new pinned topic; may be null
	NewTopicInfo ForumTopicInfo
}

// ChatEventForumTopicPinnedTypeID is TL type id of ChatEventForumTopicPinned.
const ChatEventForumTopicPinnedTypeID = 0x7fc523ee

// construct implements constructor of ChatEventActionClass.
func (c ChatEventForumTopicPinned) construct() ChatEventActionClass { return &c }

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

	_ ChatEventActionClass = &ChatEventForumTopicPinned{}
)

func (c *ChatEventForumTopicPinned) Zero() bool {
	if c == nil {
		return true
	}
	if !(c.OldTopicInfo.Zero()) {
		return false
	}
	if !(c.NewTopicInfo.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (c *ChatEventForumTopicPinned) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "chatEventForumTopicPinned",
		ID:   ChatEventForumTopicPinnedTypeID,
	}
	if c == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "OldTopicInfo",
			SchemaName: "old_topic_info",
		},
		{
			Name:       "NewTopicInfo",
			SchemaName: "new_topic_info",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (c *ChatEventForumTopicPinned) Encode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil")
	}
	b.PutID(ChatEventForumTopicPinnedTypeID)
	return c.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (c *ChatEventForumTopicPinned) EncodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil")
	}
	if err := c.OldTopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err)
	}
	if err := c.NewTopicInfo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (c *ChatEventForumTopicPinned) Decode(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil")
	}
	if err := b.ConsumeID(ChatEventForumTopicPinnedTypeID); err != nil {
		return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: %w", err)
	}
	return c.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (c *ChatEventForumTopicPinned) DecodeBare(b *bin.Buffer) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil")
	}
	{
		if err := c.OldTopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err)
		}
	}
	{
		if err := c.NewTopicInfo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatEventForumTopicPinned) EncodeTDLibJSON(b tdjson.Encoder) error {
	if c == nil {
		return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil")
	}
	b.ObjStart()
	b.PutID("chatEventForumTopicPinned")
	b.Comma()
	b.FieldStart("old_topic_info")
	if err := c.OldTopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err)
	}
	b.Comma()
	b.FieldStart("new_topic_info")
	if err := c.NewTopicInfo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatEventForumTopicPinned) DecodeTDLibJSON(b tdjson.Decoder) error {
	if c == nil {
		return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("chatEventForumTopicPinned"); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: %w", err)
			}
		case "old_topic_info":
			if err := c.OldTopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err)
			}
		case "new_topic_info":
			if err := c.NewTopicInfo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetOldTopicInfo returns value of OldTopicInfo field.
func (c *ChatEventForumTopicPinned) GetOldTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.OldTopicInfo
}

// GetNewTopicInfo returns value of NewTopicInfo field.
func (c *ChatEventForumTopicPinned) GetNewTopicInfo() (value ForumTopicInfo) {
	if c == nil {
		return
	}
	return c.NewTopicInfo
}

// ChatEventActionClassName is schema name of ChatEventActionClass.
const ChatEventActionClassName = "ChatEventAction"

// ChatEventActionClass represents ChatEventAction generic type.
//
// Example:
//
//	g, err := tdapi.DecodeChatEventAction(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tdapi.ChatEventMessageEdited: // chatEventMessageEdited#e64ff5f8
//	case *tdapi.ChatEventMessageDeleted: // chatEventMessageDeleted#37bfcd73
//	case *tdapi.ChatEventMessagePinned: // chatEventMessagePinned#1a26ad1a
//	case *tdapi.ChatEventMessageUnpinned: // chatEventMessageUnpinned#e9943b17
//	case *tdapi.ChatEventPollStopped: // chatEventPollStopped#77cc8be5
//	case *tdapi.ChatEventMemberJoined: // chatEventMemberJoined#f1f70924
//	case *tdapi.ChatEventMemberJoinedByInviteLink: // chatEventMemberJoinedByInviteLink#a9d6dd7a
//	case *tdapi.ChatEventMemberJoinedByRequest: // chatEventMemberJoinedByRequest#9dc87e3f
//	case *tdapi.ChatEventMemberInvited: // chatEventMemberInvited#38d7bfc9
//	case *tdapi.ChatEventMemberLeft: // chatEventMemberLeft#c778400f
//	case *tdapi.ChatEventMemberPromoted: // chatEventMemberPromoted#1f4f6861
//	case *tdapi.ChatEventMemberRestricted: // chatEventMemberRestricted#5f951e05
//	case *tdapi.ChatEventMemberSubscriptionExtended: // chatEventMemberSubscriptionExtended#bbfab002
//	case *tdapi.ChatEventAvailableReactionsChanged: // chatEventAvailableReactionsChanged#97b8e0bf
//	case *tdapi.ChatEventBackgroundChanged: // chatEventBackgroundChanged#b6ed6d38
//	case *tdapi.ChatEventDescriptionChanged: // chatEventDescriptionChanged#254cf1e
//	case *tdapi.ChatEventEmojiStatusChanged: // chatEventEmojiStatusChanged#83e97b1e
//	case *tdapi.ChatEventLinkedChatChanged: // chatEventLinkedChatChanged#6b2271af
//	case *tdapi.ChatEventLocationChanged: // chatEventLocationChanged#e7cdfd4e
//	case *tdapi.ChatEventMessageAutoDeleteTimeChanged: // chatEventMessageAutoDeleteTimeChanged#1083f24
//	case *tdapi.ChatEventPermissionsChanged: // chatEventPermissionsChanged#b1d337a8
//	case *tdapi.ChatEventPhotoChanged: // chatEventPhotoChanged#cfa062c3
//	case *tdapi.ChatEventSlowModeDelayChanged: // chatEventSlowModeDelayChanged#9d763c0b
//	case *tdapi.ChatEventStickerSetChanged: // chatEventStickerSetChanged#b5e7558f
//	case *tdapi.ChatEventCustomEmojiStickerSetChanged: // chatEventCustomEmojiStickerSetChanged#70c431b
//	case *tdapi.ChatEventTitleChanged: // chatEventTitleChanged#43990ad2
//	case *tdapi.ChatEventUsernameChanged: // chatEventUsernameChanged#6707b56b
//	case *tdapi.ChatEventActiveUsernamesChanged: // chatEventActiveUsernamesChanged#95e54656
//	case *tdapi.ChatEventAccentColorChanged: // chatEventAccentColorChanged#e6837733
//	case *tdapi.ChatEventProfileAccentColorChanged: // chatEventProfileAccentColorChanged#a5b8da64
//	case *tdapi.ChatEventHasProtectedContentToggled: // chatEventHasProtectedContentToggled#f5044201
//	case *tdapi.ChatEventInvitesToggled: // chatEventInvitesToggled#fc45966b
//	case *tdapi.ChatEventIsAllHistoryAvailableToggled: // chatEventIsAllHistoryAvailableToggled#a0b03c15
//	case *tdapi.ChatEventHasAggressiveAntiSpamEnabledToggled: // chatEventHasAggressiveAntiSpamEnabledToggled#f8875702
//	case *tdapi.ChatEventSignMessagesToggled: // chatEventSignMessagesToggled#b1b9281e
//	case *tdapi.ChatEventShowMessageSenderToggled: // chatEventShowMessageSenderToggled#d0a747e3
//	case *tdapi.ChatEventAutomaticTranslationToggled: // chatEventAutomaticTranslationToggled#b927656
//	case *tdapi.ChatEventInviteLinkEdited: // chatEventInviteLinkEdited#e4920d62
//	case *tdapi.ChatEventInviteLinkRevoked: // chatEventInviteLinkRevoked#a1dbffe3
//	case *tdapi.ChatEventInviteLinkDeleted: // chatEventInviteLinkDeleted#acda6167
//	case *tdapi.ChatEventVideoChatCreated: // chatEventVideoChatCreated#6ca68a7b
//	case *tdapi.ChatEventVideoChatEnded: // chatEventVideoChatEnded#61286c48
//	case *tdapi.ChatEventVideoChatMuteNewParticipantsToggled: // chatEventVideoChatMuteNewParticipantsToggled#f87507fe
//	case *tdapi.ChatEventVideoChatParticipantIsMutedToggled: // chatEventVideoChatParticipantIsMutedToggled#1f1058f7
//	case *tdapi.ChatEventVideoChatParticipantVolumeLevelChanged: // chatEventVideoChatParticipantVolumeLevelChanged#436f92be
//	case *tdapi.ChatEventIsForumToggled: // chatEventIsForumToggled#5a63d119
//	case *tdapi.ChatEventForumTopicCreated: // chatEventForumTopicCreated#7785fb42
//	case *tdapi.ChatEventForumTopicEdited: // chatEventForumTopicEdited#60da2c0c
//	case *tdapi.ChatEventForumTopicToggleIsClosed: // chatEventForumTopicToggleIsClosed#c69e4d3a
//	case *tdapi.ChatEventForumTopicToggleIsHidden: // chatEventForumTopicToggleIsHidden#a015ef2e
//	case *tdapi.ChatEventForumTopicDeleted: // chatEventForumTopicDeleted#b08f290d
//	case *tdapi.ChatEventForumTopicPinned: // chatEventForumTopicPinned#7fc523ee
//	default: panic(v)
//	}
type ChatEventActionClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() ChatEventActionClass

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

	EncodeTDLibJSON(b tdjson.Encoder) error
	DecodeTDLibJSON(b tdjson.Decoder) error
}

// DecodeChatEventAction implements binary de-serialization for ChatEventActionClass.
func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case ChatEventMessageEditedTypeID:
		// Decoding chatEventMessageEdited#e64ff5f8.
		v := ChatEventMessageEdited{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMessageDeletedTypeID:
		// Decoding chatEventMessageDeleted#37bfcd73.
		v := ChatEventMessageDeleted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMessagePinnedTypeID:
		// Decoding chatEventMessagePinned#1a26ad1a.
		v := ChatEventMessagePinned{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMessageUnpinnedTypeID:
		// Decoding chatEventMessageUnpinned#e9943b17.
		v := ChatEventMessageUnpinned{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventPollStoppedTypeID:
		// Decoding chatEventPollStopped#77cc8be5.
		v := ChatEventPollStopped{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberJoinedTypeID:
		// Decoding chatEventMemberJoined#f1f70924.
		v := ChatEventMemberJoined{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberJoinedByInviteLinkTypeID:
		// Decoding chatEventMemberJoinedByInviteLink#a9d6dd7a.
		v := ChatEventMemberJoinedByInviteLink{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberJoinedByRequestTypeID:
		// Decoding chatEventMemberJoinedByRequest#9dc87e3f.
		v := ChatEventMemberJoinedByRequest{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberInvitedTypeID:
		// Decoding chatEventMemberInvited#38d7bfc9.
		v := ChatEventMemberInvited{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberLeftTypeID:
		// Decoding chatEventMemberLeft#c778400f.
		v := ChatEventMemberLeft{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberPromotedTypeID:
		// Decoding chatEventMemberPromoted#1f4f6861.
		v := ChatEventMemberPromoted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberRestrictedTypeID:
		// Decoding chatEventMemberRestricted#5f951e05.
		v := ChatEventMemberRestricted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMemberSubscriptionExtendedTypeID:
		// Decoding chatEventMemberSubscriptionExtended#bbfab002.
		v := ChatEventMemberSubscriptionExtended{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventAvailableReactionsChangedTypeID:
		// Decoding chatEventAvailableReactionsChanged#97b8e0bf.
		v := ChatEventAvailableReactionsChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventBackgroundChangedTypeID:
		// Decoding chatEventBackgroundChanged#b6ed6d38.
		v := ChatEventBackgroundChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventDescriptionChangedTypeID:
		// Decoding chatEventDescriptionChanged#254cf1e.
		v := ChatEventDescriptionChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventEmojiStatusChangedTypeID:
		// Decoding chatEventEmojiStatusChanged#83e97b1e.
		v := ChatEventEmojiStatusChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventLinkedChatChangedTypeID:
		// Decoding chatEventLinkedChatChanged#6b2271af.
		v := ChatEventLinkedChatChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventLocationChangedTypeID:
		// Decoding chatEventLocationChanged#e7cdfd4e.
		v := ChatEventLocationChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventMessageAutoDeleteTimeChangedTypeID:
		// Decoding chatEventMessageAutoDeleteTimeChanged#1083f24.
		v := ChatEventMessageAutoDeleteTimeChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventPermissionsChangedTypeID:
		// Decoding chatEventPermissionsChanged#b1d337a8.
		v := ChatEventPermissionsChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventPhotoChangedTypeID:
		// Decoding chatEventPhotoChanged#cfa062c3.
		v := ChatEventPhotoChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventSlowModeDelayChangedTypeID:
		// Decoding chatEventSlowModeDelayChanged#9d763c0b.
		v := ChatEventSlowModeDelayChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventStickerSetChangedTypeID:
		// Decoding chatEventStickerSetChanged#b5e7558f.
		v := ChatEventStickerSetChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventCustomEmojiStickerSetChangedTypeID:
		// Decoding chatEventCustomEmojiStickerSetChanged#70c431b.
		v := ChatEventCustomEmojiStickerSetChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventTitleChangedTypeID:
		// Decoding chatEventTitleChanged#43990ad2.
		v := ChatEventTitleChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventUsernameChangedTypeID:
		// Decoding chatEventUsernameChanged#6707b56b.
		v := ChatEventUsernameChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventActiveUsernamesChangedTypeID:
		// Decoding chatEventActiveUsernamesChanged#95e54656.
		v := ChatEventActiveUsernamesChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventAccentColorChangedTypeID:
		// Decoding chatEventAccentColorChanged#e6837733.
		v := ChatEventAccentColorChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventProfileAccentColorChangedTypeID:
		// Decoding chatEventProfileAccentColorChanged#a5b8da64.
		v := ChatEventProfileAccentColorChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventHasProtectedContentToggledTypeID:
		// Decoding chatEventHasProtectedContentToggled#f5044201.
		v := ChatEventHasProtectedContentToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventInvitesToggledTypeID:
		// Decoding chatEventInvitesToggled#fc45966b.
		v := ChatEventInvitesToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventIsAllHistoryAvailableToggledTypeID:
		// Decoding chatEventIsAllHistoryAvailableToggled#a0b03c15.
		v := ChatEventIsAllHistoryAvailableToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventHasAggressiveAntiSpamEnabledToggledTypeID:
		// Decoding chatEventHasAggressiveAntiSpamEnabledToggled#f8875702.
		v := ChatEventHasAggressiveAntiSpamEnabledToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventSignMessagesToggledTypeID:
		// Decoding chatEventSignMessagesToggled#b1b9281e.
		v := ChatEventSignMessagesToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventShowMessageSenderToggledTypeID:
		// Decoding chatEventShowMessageSenderToggled#d0a747e3.
		v := ChatEventShowMessageSenderToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventAutomaticTranslationToggledTypeID:
		// Decoding chatEventAutomaticTranslationToggled#b927656.
		v := ChatEventAutomaticTranslationToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventInviteLinkEditedTypeID:
		// Decoding chatEventInviteLinkEdited#e4920d62.
		v := ChatEventInviteLinkEdited{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventInviteLinkRevokedTypeID:
		// Decoding chatEventInviteLinkRevoked#a1dbffe3.
		v := ChatEventInviteLinkRevoked{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventInviteLinkDeletedTypeID:
		// Decoding chatEventInviteLinkDeleted#acda6167.
		v := ChatEventInviteLinkDeleted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventVideoChatCreatedTypeID:
		// Decoding chatEventVideoChatCreated#6ca68a7b.
		v := ChatEventVideoChatCreated{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventVideoChatEndedTypeID:
		// Decoding chatEventVideoChatEnded#61286c48.
		v := ChatEventVideoChatEnded{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventVideoChatMuteNewParticipantsToggledTypeID:
		// Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe.
		v := ChatEventVideoChatMuteNewParticipantsToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventVideoChatParticipantIsMutedToggledTypeID:
		// Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7.
		v := ChatEventVideoChatParticipantIsMutedToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventVideoChatParticipantVolumeLevelChangedTypeID:
		// Decoding chatEventVideoChatParticipantVolumeLevelChanged#436f92be.
		v := ChatEventVideoChatParticipantVolumeLevelChanged{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventIsForumToggledTypeID:
		// Decoding chatEventIsForumToggled#5a63d119.
		v := ChatEventIsForumToggled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicCreatedTypeID:
		// Decoding chatEventForumTopicCreated#7785fb42.
		v := ChatEventForumTopicCreated{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicEditedTypeID:
		// Decoding chatEventForumTopicEdited#60da2c0c.
		v := ChatEventForumTopicEdited{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicToggleIsClosedTypeID:
		// Decoding chatEventForumTopicToggleIsClosed#c69e4d3a.
		v := ChatEventForumTopicToggleIsClosed{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicToggleIsHiddenTypeID:
		// Decoding chatEventForumTopicToggleIsHidden#a015ef2e.
		v := ChatEventForumTopicToggleIsHidden{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicDeletedTypeID:
		// Decoding chatEventForumTopicDeleted#b08f290d.
		v := ChatEventForumTopicDeleted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case ChatEventForumTopicPinnedTypeID:
		// Decoding chatEventForumTopicPinned#7fc523ee.
		v := ChatEventForumTopicPinned{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecodeTDLibJSONChatEventAction implements binary de-serialization for ChatEventActionClass.
func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, error) {
	id, err := buf.FindTypeID()
	if err != nil {
		return nil, err
	}
	switch id {
	case "chatEventMessageEdited":
		// Decoding chatEventMessageEdited#e64ff5f8.
		v := ChatEventMessageEdited{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMessageDeleted":
		// Decoding chatEventMessageDeleted#37bfcd73.
		v := ChatEventMessageDeleted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMessagePinned":
		// Decoding chatEventMessagePinned#1a26ad1a.
		v := ChatEventMessagePinned{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMessageUnpinned":
		// Decoding chatEventMessageUnpinned#e9943b17.
		v := ChatEventMessageUnpinned{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventPollStopped":
		// Decoding chatEventPollStopped#77cc8be5.
		v := ChatEventPollStopped{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberJoined":
		// Decoding chatEventMemberJoined#f1f70924.
		v := ChatEventMemberJoined{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberJoinedByInviteLink":
		// Decoding chatEventMemberJoinedByInviteLink#a9d6dd7a.
		v := ChatEventMemberJoinedByInviteLink{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberJoinedByRequest":
		// Decoding chatEventMemberJoinedByRequest#9dc87e3f.
		v := ChatEventMemberJoinedByRequest{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberInvited":
		// Decoding chatEventMemberInvited#38d7bfc9.
		v := ChatEventMemberInvited{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberLeft":
		// Decoding chatEventMemberLeft#c778400f.
		v := ChatEventMemberLeft{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberPromoted":
		// Decoding chatEventMemberPromoted#1f4f6861.
		v := ChatEventMemberPromoted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberRestricted":
		// Decoding chatEventMemberRestricted#5f951e05.
		v := ChatEventMemberRestricted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMemberSubscriptionExtended":
		// Decoding chatEventMemberSubscriptionExtended#bbfab002.
		v := ChatEventMemberSubscriptionExtended{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventAvailableReactionsChanged":
		// Decoding chatEventAvailableReactionsChanged#97b8e0bf.
		v := ChatEventAvailableReactionsChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventBackgroundChanged":
		// Decoding chatEventBackgroundChanged#b6ed6d38.
		v := ChatEventBackgroundChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventDescriptionChanged":
		// Decoding chatEventDescriptionChanged#254cf1e.
		v := ChatEventDescriptionChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventEmojiStatusChanged":
		// Decoding chatEventEmojiStatusChanged#83e97b1e.
		v := ChatEventEmojiStatusChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventLinkedChatChanged":
		// Decoding chatEventLinkedChatChanged#6b2271af.
		v := ChatEventLinkedChatChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventLocationChanged":
		// Decoding chatEventLocationChanged#e7cdfd4e.
		v := ChatEventLocationChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventMessageAutoDeleteTimeChanged":
		// Decoding chatEventMessageAutoDeleteTimeChanged#1083f24.
		v := ChatEventMessageAutoDeleteTimeChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventPermissionsChanged":
		// Decoding chatEventPermissionsChanged#b1d337a8.
		v := ChatEventPermissionsChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventPhotoChanged":
		// Decoding chatEventPhotoChanged#cfa062c3.
		v := ChatEventPhotoChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventSlowModeDelayChanged":
		// Decoding chatEventSlowModeDelayChanged#9d763c0b.
		v := ChatEventSlowModeDelayChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventStickerSetChanged":
		// Decoding chatEventStickerSetChanged#b5e7558f.
		v := ChatEventStickerSetChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventCustomEmojiStickerSetChanged":
		// Decoding chatEventCustomEmojiStickerSetChanged#70c431b.
		v := ChatEventCustomEmojiStickerSetChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventTitleChanged":
		// Decoding chatEventTitleChanged#43990ad2.
		v := ChatEventTitleChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventUsernameChanged":
		// Decoding chatEventUsernameChanged#6707b56b.
		v := ChatEventUsernameChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventActiveUsernamesChanged":
		// Decoding chatEventActiveUsernamesChanged#95e54656.
		v := ChatEventActiveUsernamesChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventAccentColorChanged":
		// Decoding chatEventAccentColorChanged#e6837733.
		v := ChatEventAccentColorChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventProfileAccentColorChanged":
		// Decoding chatEventProfileAccentColorChanged#a5b8da64.
		v := ChatEventProfileAccentColorChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventHasProtectedContentToggled":
		// Decoding chatEventHasProtectedContentToggled#f5044201.
		v := ChatEventHasProtectedContentToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventInvitesToggled":
		// Decoding chatEventInvitesToggled#fc45966b.
		v := ChatEventInvitesToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventIsAllHistoryAvailableToggled":
		// Decoding chatEventIsAllHistoryAvailableToggled#a0b03c15.
		v := ChatEventIsAllHistoryAvailableToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventHasAggressiveAntiSpamEnabledToggled":
		// Decoding chatEventHasAggressiveAntiSpamEnabledToggled#f8875702.
		v := ChatEventHasAggressiveAntiSpamEnabledToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventSignMessagesToggled":
		// Decoding chatEventSignMessagesToggled#b1b9281e.
		v := ChatEventSignMessagesToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventShowMessageSenderToggled":
		// Decoding chatEventShowMessageSenderToggled#d0a747e3.
		v := ChatEventShowMessageSenderToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventAutomaticTranslationToggled":
		// Decoding chatEventAutomaticTranslationToggled#b927656.
		v := ChatEventAutomaticTranslationToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventInviteLinkEdited":
		// Decoding chatEventInviteLinkEdited#e4920d62.
		v := ChatEventInviteLinkEdited{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventInviteLinkRevoked":
		// Decoding chatEventInviteLinkRevoked#a1dbffe3.
		v := ChatEventInviteLinkRevoked{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventInviteLinkDeleted":
		// Decoding chatEventInviteLinkDeleted#acda6167.
		v := ChatEventInviteLinkDeleted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventVideoChatCreated":
		// Decoding chatEventVideoChatCreated#6ca68a7b.
		v := ChatEventVideoChatCreated{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventVideoChatEnded":
		// Decoding chatEventVideoChatEnded#61286c48.
		v := ChatEventVideoChatEnded{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventVideoChatMuteNewParticipantsToggled":
		// Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe.
		v := ChatEventVideoChatMuteNewParticipantsToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventVideoChatParticipantIsMutedToggled":
		// Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7.
		v := ChatEventVideoChatParticipantIsMutedToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventVideoChatParticipantVolumeLevelChanged":
		// Decoding chatEventVideoChatParticipantVolumeLevelChanged#436f92be.
		v := ChatEventVideoChatParticipantVolumeLevelChanged{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventIsForumToggled":
		// Decoding chatEventIsForumToggled#5a63d119.
		v := ChatEventIsForumToggled{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicCreated":
		// Decoding chatEventForumTopicCreated#7785fb42.
		v := ChatEventForumTopicCreated{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicEdited":
		// Decoding chatEventForumTopicEdited#60da2c0c.
		v := ChatEventForumTopicEdited{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicToggleIsClosed":
		// Decoding chatEventForumTopicToggleIsClosed#c69e4d3a.
		v := ChatEventForumTopicToggleIsClosed{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicToggleIsHidden":
		// Decoding chatEventForumTopicToggleIsHidden#a015ef2e.
		v := ChatEventForumTopicToggleIsHidden{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicDeleted":
		// Decoding chatEventForumTopicDeleted#b08f290d.
		v := ChatEventForumTopicDeleted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	case "chatEventForumTopicPinned":
		// Decoding chatEventForumTopicPinned#7fc523ee.
		v := ChatEventForumTopicPinned{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", tdjson.NewUnexpectedID(id))
	}
}

// ChatEventAction boxes the ChatEventActionClass providing a helper.
type ChatEventActionBox struct {
	ChatEventAction ChatEventActionClass
}

// Decode implements bin.Decoder for ChatEventActionBox.
func (b *ChatEventActionBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode ChatEventActionBox to nil")
	}
	v, err := DecodeChatEventAction(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.ChatEventAction = v
	return nil
}

// Encode implements bin.Encode for ChatEventActionBox.
func (b *ChatEventActionBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.ChatEventAction == nil {
		return fmt.Errorf("unable to encode ChatEventActionClass as nil")
	}
	return b.ChatEventAction.Encode(buf)
}

// DecodeTDLibJSON implements bin.Decoder for ChatEventActionBox.
func (b *ChatEventActionBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
	if b == nil {
		return fmt.Errorf("unable to decode ChatEventActionBox to nil")
	}
	v, err := DecodeTDLibJSONChatEventAction(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.ChatEventAction = v
	return nil
}

// EncodeTDLibJSON implements bin.Encode for ChatEventActionBox.
func (b *ChatEventActionBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
	if b == nil || b.ChatEventAction == nil {
		return fmt.Errorf("unable to encode ChatEventActionClass as nil")
	}
	return b.ChatEventAction.EncodeTDLibJSON(buf)
}
