// Code generated by gotdgen, DO NOT EDIT.

package tg

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

// InputMessagesFilterEmpty represents TL type `inputMessagesFilterEmpty#57e2f66c`.
// Filter is absent.
//
// See https://core.telegram.org/constructor/inputMessagesFilterEmpty for reference.
type InputMessagesFilterEmpty struct {
}

// InputMessagesFilterEmptyTypeID is TL type id of InputMessagesFilterEmpty.
const InputMessagesFilterEmptyTypeID = 0x57e2f66c

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterEmpty) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterEmpty{}
)

func (i *InputMessagesFilterEmpty) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterEmpty) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterEmpty#57e2f66c as nil")
	}
	b.PutID(InputMessagesFilterEmptyTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterEmpty) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterEmpty#57e2f66c as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterEmpty) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterEmpty#57e2f66c to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterEmptyTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterEmpty#57e2f66c: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterEmpty) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterEmpty#57e2f66c to nil")
	}
	return nil
}

// InputMessagesFilterPhotos represents TL type `inputMessagesFilterPhotos#9609a51c`.
// Filter for messages containing photos.
//
// See https://core.telegram.org/constructor/inputMessagesFilterPhotos for reference.
type InputMessagesFilterPhotos struct {
}

// InputMessagesFilterPhotosTypeID is TL type id of InputMessagesFilterPhotos.
const InputMessagesFilterPhotosTypeID = 0x9609a51c

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterPhotos) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterPhotos{}
)

func (i *InputMessagesFilterPhotos) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterPhotos) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhotos#9609a51c as nil")
	}
	b.PutID(InputMessagesFilterPhotosTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterPhotos) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhotos#9609a51c as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterPhotos) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhotos#9609a51c to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterPhotosTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterPhotos#9609a51c: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterPhotos) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhotos#9609a51c to nil")
	}
	return nil
}

// InputMessagesFilterVideo represents TL type `inputMessagesFilterVideo#9fc00e65`.
// Filter for messages containing videos.
//
// See https://core.telegram.org/constructor/inputMessagesFilterVideo for reference.
type InputMessagesFilterVideo struct {
}

// InputMessagesFilterVideoTypeID is TL type id of InputMessagesFilterVideo.
const InputMessagesFilterVideoTypeID = 0x9fc00e65

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterVideo) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterVideo{}
)

func (i *InputMessagesFilterVideo) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterVideo) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterVideo#9fc00e65 as nil")
	}
	b.PutID(InputMessagesFilterVideoTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterVideo) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterVideo#9fc00e65 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterVideo) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterVideo#9fc00e65 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterVideoTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterVideo#9fc00e65: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterVideo) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterVideo#9fc00e65 to nil")
	}
	return nil
}

// InputMessagesFilterPhotoVideo represents TL type `inputMessagesFilterPhotoVideo#56e9f0e4`.
// Filter for messages containing photos or videos.
//
// See https://core.telegram.org/constructor/inputMessagesFilterPhotoVideo for reference.
type InputMessagesFilterPhotoVideo struct {
}

// InputMessagesFilterPhotoVideoTypeID is TL type id of InputMessagesFilterPhotoVideo.
const InputMessagesFilterPhotoVideoTypeID = 0x56e9f0e4

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterPhotoVideo) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterPhotoVideo{}
)

func (i *InputMessagesFilterPhotoVideo) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterPhotoVideo) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhotoVideo#56e9f0e4 as nil")
	}
	b.PutID(InputMessagesFilterPhotoVideoTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterPhotoVideo) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhotoVideo#56e9f0e4 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterPhotoVideo) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhotoVideo#56e9f0e4 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterPhotoVideoTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterPhotoVideo#56e9f0e4: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterPhotoVideo) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhotoVideo#56e9f0e4 to nil")
	}
	return nil
}

// InputMessagesFilterDocument represents TL type `inputMessagesFilterDocument#9eddf188`.
// Filter for messages containing documents.
//
// See https://core.telegram.org/constructor/inputMessagesFilterDocument for reference.
type InputMessagesFilterDocument struct {
}

// InputMessagesFilterDocumentTypeID is TL type id of InputMessagesFilterDocument.
const InputMessagesFilterDocumentTypeID = 0x9eddf188

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterDocument) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterDocument{}
)

func (i *InputMessagesFilterDocument) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterDocument) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterDocument#9eddf188 as nil")
	}
	b.PutID(InputMessagesFilterDocumentTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterDocument) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterDocument#9eddf188 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterDocument) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterDocument#9eddf188 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterDocumentTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterDocument#9eddf188: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterDocument) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterDocument#9eddf188 to nil")
	}
	return nil
}

// InputMessagesFilterURL represents TL type `inputMessagesFilterUrl#7ef0dd87`.
// Return only messages containing URLs
//
// See https://core.telegram.org/constructor/inputMessagesFilterUrl for reference.
type InputMessagesFilterURL struct {
}

// InputMessagesFilterURLTypeID is TL type id of InputMessagesFilterURL.
const InputMessagesFilterURLTypeID = 0x7ef0dd87

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterURL) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterURL{}
)

func (i *InputMessagesFilterURL) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterURL) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterUrl#7ef0dd87 as nil")
	}
	b.PutID(InputMessagesFilterURLTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterURL) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterUrl#7ef0dd87 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterURL) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterUrl#7ef0dd87 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterURLTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterUrl#7ef0dd87: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterURL) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterUrl#7ef0dd87 to nil")
	}
	return nil
}

// InputMessagesFilterGif represents TL type `inputMessagesFilterGif#ffc86587`.
// Return only messages containing gifs
//
// See https://core.telegram.org/constructor/inputMessagesFilterGif for reference.
type InputMessagesFilterGif struct {
}

// InputMessagesFilterGifTypeID is TL type id of InputMessagesFilterGif.
const InputMessagesFilterGifTypeID = 0xffc86587

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterGif) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterGif{}
)

func (i *InputMessagesFilterGif) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterGif) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterGif#ffc86587 as nil")
	}
	b.PutID(InputMessagesFilterGifTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterGif) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterGif#ffc86587 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterGif) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterGif#ffc86587 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterGifTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterGif#ffc86587: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterGif) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterGif#ffc86587 to nil")
	}
	return nil
}

// InputMessagesFilterVoice represents TL type `inputMessagesFilterVoice#50f5c392`.
// Return only messages containing voice notes
//
// See https://core.telegram.org/constructor/inputMessagesFilterVoice for reference.
type InputMessagesFilterVoice struct {
}

// InputMessagesFilterVoiceTypeID is TL type id of InputMessagesFilterVoice.
const InputMessagesFilterVoiceTypeID = 0x50f5c392

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterVoice) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterVoice{}
)

func (i *InputMessagesFilterVoice) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterVoice) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterVoice#50f5c392 as nil")
	}
	b.PutID(InputMessagesFilterVoiceTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterVoice) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterVoice#50f5c392 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterVoice) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterVoice#50f5c392 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterVoiceTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterVoice#50f5c392: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterVoice) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterVoice#50f5c392 to nil")
	}
	return nil
}

// InputMessagesFilterMusic represents TL type `inputMessagesFilterMusic#3751b49e`.
// Return only messages containing audio files
//
// See https://core.telegram.org/constructor/inputMessagesFilterMusic for reference.
type InputMessagesFilterMusic struct {
}

// InputMessagesFilterMusicTypeID is TL type id of InputMessagesFilterMusic.
const InputMessagesFilterMusicTypeID = 0x3751b49e

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterMusic) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterMusic{}
)

func (i *InputMessagesFilterMusic) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterMusic) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterMusic#3751b49e as nil")
	}
	b.PutID(InputMessagesFilterMusicTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterMusic) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterMusic#3751b49e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterMusic) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterMusic#3751b49e to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterMusicTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterMusic#3751b49e: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterMusic) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterMusic#3751b49e to nil")
	}
	return nil
}

// InputMessagesFilterChatPhotos represents TL type `inputMessagesFilterChatPhotos#3a20ecb8`.
// Return only chat photo changes
//
// See https://core.telegram.org/constructor/inputMessagesFilterChatPhotos for reference.
type InputMessagesFilterChatPhotos struct {
}

// InputMessagesFilterChatPhotosTypeID is TL type id of InputMessagesFilterChatPhotos.
const InputMessagesFilterChatPhotosTypeID = 0x3a20ecb8

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterChatPhotos) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterChatPhotos{}
)

func (i *InputMessagesFilterChatPhotos) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterChatPhotos) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterChatPhotos#3a20ecb8 as nil")
	}
	b.PutID(InputMessagesFilterChatPhotosTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterChatPhotos) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterChatPhotos#3a20ecb8 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterChatPhotos) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterChatPhotos#3a20ecb8 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterChatPhotosTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterChatPhotos#3a20ecb8: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterChatPhotos) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterChatPhotos#3a20ecb8 to nil")
	}
	return nil
}

// InputMessagesFilterPhoneCalls represents TL type `inputMessagesFilterPhoneCalls#80c99768`.
// Return only phone calls
//
// See https://core.telegram.org/constructor/inputMessagesFilterPhoneCalls for reference.
type InputMessagesFilterPhoneCalls struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Return only missed phone calls
	Missed bool
}

// InputMessagesFilterPhoneCallsTypeID is TL type id of InputMessagesFilterPhoneCalls.
const InputMessagesFilterPhoneCallsTypeID = 0x80c99768

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterPhoneCalls) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterPhoneCalls{}
)

func (i *InputMessagesFilterPhoneCalls) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Flags.Zero()) {
		return false
	}
	if !(i.Missed == false) {
		return false
	}

	return true
}

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

// FillFrom fills InputMessagesFilterPhoneCalls from given interface.
func (i *InputMessagesFilterPhoneCalls) FillFrom(from interface {
	GetMissed() (value bool)
}) {
	i.Missed = from.GetMissed()
}

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

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

// TypeInfo returns info about TL type.
func (i *InputMessagesFilterPhoneCalls) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "inputMessagesFilterPhoneCalls",
		ID:   InputMessagesFilterPhoneCallsTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Missed",
			SchemaName: "missed",
			Null:       !i.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (i *InputMessagesFilterPhoneCalls) SetFlags() {
	if !(i.Missed == false) {
		i.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (i *InputMessagesFilterPhoneCalls) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhoneCalls#80c99768 as nil")
	}
	b.PutID(InputMessagesFilterPhoneCallsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterPhoneCalls) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPhoneCalls#80c99768 as nil")
	}
	i.SetFlags()
	if err := i.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode inputMessagesFilterPhoneCalls#80c99768: field flags: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterPhoneCalls) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhoneCalls#80c99768 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterPhoneCallsTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterPhoneCalls#80c99768: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterPhoneCalls) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPhoneCalls#80c99768 to nil")
	}
	{
		if err := i.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode inputMessagesFilterPhoneCalls#80c99768: field flags: %w", err)
		}
	}
	i.Missed = i.Flags.Has(0)
	return nil
}

// SetMissed sets value of Missed conditional field.
func (i *InputMessagesFilterPhoneCalls) SetMissed(value bool) {
	if value {
		i.Flags.Set(0)
		i.Missed = true
	} else {
		i.Flags.Unset(0)
		i.Missed = false
	}
}

// GetMissed returns value of Missed conditional field.
func (i *InputMessagesFilterPhoneCalls) GetMissed() (value bool) {
	if i == nil {
		return
	}
	return i.Flags.Has(0)
}

// InputMessagesFilterRoundVoice represents TL type `inputMessagesFilterRoundVoice#7a7c17a4`.
// Return only round videos and voice notes
//
// See https://core.telegram.org/constructor/inputMessagesFilterRoundVoice for reference.
type InputMessagesFilterRoundVoice struct {
}

// InputMessagesFilterRoundVoiceTypeID is TL type id of InputMessagesFilterRoundVoice.
const InputMessagesFilterRoundVoiceTypeID = 0x7a7c17a4

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterRoundVoice) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterRoundVoice{}
)

func (i *InputMessagesFilterRoundVoice) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterRoundVoice) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterRoundVoice#7a7c17a4 as nil")
	}
	b.PutID(InputMessagesFilterRoundVoiceTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterRoundVoice) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterRoundVoice#7a7c17a4 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterRoundVoice) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterRoundVoice#7a7c17a4 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterRoundVoiceTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterRoundVoice#7a7c17a4: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterRoundVoice) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterRoundVoice#7a7c17a4 to nil")
	}
	return nil
}

// InputMessagesFilterRoundVideo represents TL type `inputMessagesFilterRoundVideo#b549da53`.
// Return only round videos
//
// See https://core.telegram.org/constructor/inputMessagesFilterRoundVideo for reference.
type InputMessagesFilterRoundVideo struct {
}

// InputMessagesFilterRoundVideoTypeID is TL type id of InputMessagesFilterRoundVideo.
const InputMessagesFilterRoundVideoTypeID = 0xb549da53

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterRoundVideo) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterRoundVideo{}
)

func (i *InputMessagesFilterRoundVideo) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterRoundVideo) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterRoundVideo#b549da53 as nil")
	}
	b.PutID(InputMessagesFilterRoundVideoTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterRoundVideo) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterRoundVideo#b549da53 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterRoundVideo) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterRoundVideo#b549da53 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterRoundVideoTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterRoundVideo#b549da53: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterRoundVideo) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterRoundVideo#b549da53 to nil")
	}
	return nil
}

// InputMessagesFilterMyMentions represents TL type `inputMessagesFilterMyMentions#c1f8e69a`.
// Return only messages where the current user was mentioned¹.
//
// Links:
//  1. https://core.telegram.org/api/mentions
//
// See https://core.telegram.org/constructor/inputMessagesFilterMyMentions for reference.
type InputMessagesFilterMyMentions struct {
}

// InputMessagesFilterMyMentionsTypeID is TL type id of InputMessagesFilterMyMentions.
const InputMessagesFilterMyMentionsTypeID = 0xc1f8e69a

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterMyMentions) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterMyMentions{}
)

func (i *InputMessagesFilterMyMentions) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterMyMentions) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterMyMentions#c1f8e69a as nil")
	}
	b.PutID(InputMessagesFilterMyMentionsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterMyMentions) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterMyMentions#c1f8e69a as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterMyMentions) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterMyMentions#c1f8e69a to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterMyMentionsTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterMyMentions#c1f8e69a: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterMyMentions) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterMyMentions#c1f8e69a to nil")
	}
	return nil
}

// InputMessagesFilterGeo represents TL type `inputMessagesFilterGeo#e7026d0d`.
// Return only messages containing geolocations
//
// See https://core.telegram.org/constructor/inputMessagesFilterGeo for reference.
type InputMessagesFilterGeo struct {
}

// InputMessagesFilterGeoTypeID is TL type id of InputMessagesFilterGeo.
const InputMessagesFilterGeoTypeID = 0xe7026d0d

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterGeo) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterGeo{}
)

func (i *InputMessagesFilterGeo) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterGeo) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterGeo#e7026d0d as nil")
	}
	b.PutID(InputMessagesFilterGeoTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterGeo) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterGeo#e7026d0d as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterGeo) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterGeo#e7026d0d to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterGeoTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterGeo#e7026d0d: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterGeo) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterGeo#e7026d0d to nil")
	}
	return nil
}

// InputMessagesFilterContacts represents TL type `inputMessagesFilterContacts#e062db83`.
// Return only messages containing contacts
//
// See https://core.telegram.org/constructor/inputMessagesFilterContacts for reference.
type InputMessagesFilterContacts struct {
}

// InputMessagesFilterContactsTypeID is TL type id of InputMessagesFilterContacts.
const InputMessagesFilterContactsTypeID = 0xe062db83

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterContacts) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterContacts{}
)

func (i *InputMessagesFilterContacts) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterContacts) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterContacts#e062db83 as nil")
	}
	b.PutID(InputMessagesFilterContactsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterContacts) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterContacts#e062db83 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterContacts) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterContacts#e062db83 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterContactsTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterContacts#e062db83: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterContacts) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterContacts#e062db83 to nil")
	}
	return nil
}

// InputMessagesFilterPinned represents TL type `inputMessagesFilterPinned#1bb00451`.
// Fetch only pinned messages
//
// See https://core.telegram.org/constructor/inputMessagesFilterPinned for reference.
type InputMessagesFilterPinned struct {
}

// InputMessagesFilterPinnedTypeID is TL type id of InputMessagesFilterPinned.
const InputMessagesFilterPinnedTypeID = 0x1bb00451

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterPinned) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterPinned{}
)

func (i *InputMessagesFilterPinned) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterPinned) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPinned#1bb00451 as nil")
	}
	b.PutID(InputMessagesFilterPinnedTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterPinned) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPinned#1bb00451 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterPinned) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPinned#1bb00451 to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterPinnedTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterPinned#1bb00451: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterPinned) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPinned#1bb00451 to nil")
	}
	return nil
}

// InputMessagesFilterPoll represents TL type `inputMessagesFilterPoll#fa2bc90a`.
//
// See https://core.telegram.org/constructor/inputMessagesFilterPoll for reference.
type InputMessagesFilterPoll struct {
}

// InputMessagesFilterPollTypeID is TL type id of InputMessagesFilterPoll.
const InputMessagesFilterPollTypeID = 0xfa2bc90a

// construct implements constructor of MessagesFilterClass.
func (i InputMessagesFilterPoll) construct() MessagesFilterClass { return &i }

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

	_ MessagesFilterClass = &InputMessagesFilterPoll{}
)

func (i *InputMessagesFilterPoll) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputMessagesFilterPoll) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPoll#fa2bc90a as nil")
	}
	b.PutID(InputMessagesFilterPollTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputMessagesFilterPoll) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputMessagesFilterPoll#fa2bc90a as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputMessagesFilterPoll) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPoll#fa2bc90a to nil")
	}
	if err := b.ConsumeID(InputMessagesFilterPollTypeID); err != nil {
		return fmt.Errorf("unable to decode inputMessagesFilterPoll#fa2bc90a: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputMessagesFilterPoll) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputMessagesFilterPoll#fa2bc90a to nil")
	}
	return nil
}

// MessagesFilterClassName is schema name of MessagesFilterClass.
const MessagesFilterClassName = "MessagesFilter"

// MessagesFilterClass represents MessagesFilter generic type.
//
// See https://core.telegram.org/type/MessagesFilter for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesFilter(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputMessagesFilterEmpty: // inputMessagesFilterEmpty#57e2f66c
//	case *tg.InputMessagesFilterPhotos: // inputMessagesFilterPhotos#9609a51c
//	case *tg.InputMessagesFilterVideo: // inputMessagesFilterVideo#9fc00e65
//	case *tg.InputMessagesFilterPhotoVideo: // inputMessagesFilterPhotoVideo#56e9f0e4
//	case *tg.InputMessagesFilterDocument: // inputMessagesFilterDocument#9eddf188
//	case *tg.InputMessagesFilterURL: // inputMessagesFilterUrl#7ef0dd87
//	case *tg.InputMessagesFilterGif: // inputMessagesFilterGif#ffc86587
//	case *tg.InputMessagesFilterVoice: // inputMessagesFilterVoice#50f5c392
//	case *tg.InputMessagesFilterMusic: // inputMessagesFilterMusic#3751b49e
//	case *tg.InputMessagesFilterChatPhotos: // inputMessagesFilterChatPhotos#3a20ecb8
//	case *tg.InputMessagesFilterPhoneCalls: // inputMessagesFilterPhoneCalls#80c99768
//	case *tg.InputMessagesFilterRoundVoice: // inputMessagesFilterRoundVoice#7a7c17a4
//	case *tg.InputMessagesFilterRoundVideo: // inputMessagesFilterRoundVideo#b549da53
//	case *tg.InputMessagesFilterMyMentions: // inputMessagesFilterMyMentions#c1f8e69a
//	case *tg.InputMessagesFilterGeo: // inputMessagesFilterGeo#e7026d0d
//	case *tg.InputMessagesFilterContacts: // inputMessagesFilterContacts#e062db83
//	case *tg.InputMessagesFilterPinned: // inputMessagesFilterPinned#1bb00451
//	case *tg.InputMessagesFilterPoll: // inputMessagesFilterPoll#fa2bc90a
//	default: panic(v)
//	}
type MessagesFilterClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesFilterClass

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

// DecodeMessagesFilter implements binary de-serialization for MessagesFilterClass.
func DecodeMessagesFilter(buf *bin.Buffer) (MessagesFilterClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case InputMessagesFilterEmptyTypeID:
		// Decoding inputMessagesFilterEmpty#57e2f66c.
		v := InputMessagesFilterEmpty{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterPhotosTypeID:
		// Decoding inputMessagesFilterPhotos#9609a51c.
		v := InputMessagesFilterPhotos{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterVideoTypeID:
		// Decoding inputMessagesFilterVideo#9fc00e65.
		v := InputMessagesFilterVideo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterPhotoVideoTypeID:
		// Decoding inputMessagesFilterPhotoVideo#56e9f0e4.
		v := InputMessagesFilterPhotoVideo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterDocumentTypeID:
		// Decoding inputMessagesFilterDocument#9eddf188.
		v := InputMessagesFilterDocument{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterURLTypeID:
		// Decoding inputMessagesFilterUrl#7ef0dd87.
		v := InputMessagesFilterURL{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterGifTypeID:
		// Decoding inputMessagesFilterGif#ffc86587.
		v := InputMessagesFilterGif{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterVoiceTypeID:
		// Decoding inputMessagesFilterVoice#50f5c392.
		v := InputMessagesFilterVoice{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterMusicTypeID:
		// Decoding inputMessagesFilterMusic#3751b49e.
		v := InputMessagesFilterMusic{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterChatPhotosTypeID:
		// Decoding inputMessagesFilterChatPhotos#3a20ecb8.
		v := InputMessagesFilterChatPhotos{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterPhoneCallsTypeID:
		// Decoding inputMessagesFilterPhoneCalls#80c99768.
		v := InputMessagesFilterPhoneCalls{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterRoundVoiceTypeID:
		// Decoding inputMessagesFilterRoundVoice#7a7c17a4.
		v := InputMessagesFilterRoundVoice{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterRoundVideoTypeID:
		// Decoding inputMessagesFilterRoundVideo#b549da53.
		v := InputMessagesFilterRoundVideo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterMyMentionsTypeID:
		// Decoding inputMessagesFilterMyMentions#c1f8e69a.
		v := InputMessagesFilterMyMentions{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterGeoTypeID:
		// Decoding inputMessagesFilterGeo#e7026d0d.
		v := InputMessagesFilterGeo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterContactsTypeID:
		// Decoding inputMessagesFilterContacts#e062db83.
		v := InputMessagesFilterContacts{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterPinnedTypeID:
		// Decoding inputMessagesFilterPinned#1bb00451.
		v := InputMessagesFilterPinned{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	case InputMessagesFilterPollTypeID:
		// Decoding inputMessagesFilterPoll#fa2bc90a.
		v := InputMessagesFilterPoll{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", bin.NewUnexpectedID(id))
	}
}

// MessagesFilter boxes the MessagesFilterClass providing a helper.
type MessagesFilterBox struct {
	MessagesFilter MessagesFilterClass
}

// Decode implements bin.Decoder for MessagesFilterBox.
func (b *MessagesFilterBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode MessagesFilterBox to nil")
	}
	v, err := DecodeMessagesFilter(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.MessagesFilter = v
	return nil
}

// Encode implements bin.Encode for MessagesFilterBox.
func (b *MessagesFilterBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.MessagesFilter == nil {
		return fmt.Errorf("unable to encode MessagesFilterClass as nil")
	}
	return b.MessagesFilter.Encode(buf)
}
