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

// PushMessageContentHidden represents TL type `pushMessageContentHidden#ed1bb85c`.
type PushMessageContentHidden struct {
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentHiddenTypeID is TL type id of PushMessageContentHidden.
const PushMessageContentHiddenTypeID = 0xed1bb85c

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentHidden) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentHidden{}
)

func (p *PushMessageContentHidden) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentHidden) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentHidden",
		ID:   PushMessageContentHiddenTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentHidden) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil")
	}
	b.PutID(PushMessageContentHiddenTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentHidden) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil")
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentHidden) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil")
	}
	if err := b.ConsumeID(PushMessageContentHiddenTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentHidden) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentHidden) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentHidden")
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentHidden) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil")
	}

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

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentHidden) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentAnimation represents TL type `pushMessageContentAnimation#3da4dfe4`.
type PushMessageContentAnimation struct {
	// Message content; may be null
	Animation Animation
	// Animation caption
	Caption string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentAnimationTypeID is TL type id of PushMessageContentAnimation.
const PushMessageContentAnimationTypeID = 0x3da4dfe4

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentAnimation) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentAnimation{}
)

func (p *PushMessageContentAnimation) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Animation.Zero()) {
		return false
	}
	if !(p.Caption == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentAnimation) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentAnimation",
		ID:   PushMessageContentAnimationTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Animation",
			SchemaName: "animation",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentAnimation) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil")
	}
	b.PutID(PushMessageContentAnimationTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentAnimation) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil")
	}
	if err := p.Animation.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentAnimation#3da4dfe4: field animation: %w", err)
	}
	b.PutString(p.Caption)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentAnimation) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil")
	}
	if err := b.ConsumeID(PushMessageContentAnimationTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentAnimation) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil")
	}
	{
		if err := p.Animation.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field animation: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field caption: %w", err)
		}
		p.Caption = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentAnimation) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentAnimation")
	b.Comma()
	b.FieldStart("animation")
	if err := p.Animation.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentAnimation#3da4dfe4: field animation: %w", err)
	}
	b.Comma()
	b.FieldStart("caption")
	b.PutString(p.Caption)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentAnimation) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentAnimation"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: %w", err)
			}
		case "animation":
			if err := p.Animation.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field animation: %w", err)
			}
		case "caption":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field caption: %w", err)
			}
			p.Caption = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetAnimation returns value of Animation field.
func (p *PushMessageContentAnimation) GetAnimation() (value Animation) {
	if p == nil {
		return
	}
	return p.Animation
}

// GetCaption returns value of Caption field.
func (p *PushMessageContentAnimation) GetCaption() (value string) {
	if p == nil {
		return
	}
	return p.Caption
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentAnimation) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentAudio represents TL type `pushMessageContentAudio#16be7872`.
type PushMessageContentAudio struct {
	// Message content; may be null
	Audio Audio
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentAudioTypeID is TL type id of PushMessageContentAudio.
const PushMessageContentAudioTypeID = 0x16be7872

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentAudio) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentAudio{}
)

func (p *PushMessageContentAudio) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Audio.Zero()) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentAudio) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentAudio",
		ID:   PushMessageContentAudioTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Audio",
			SchemaName: "audio",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentAudio) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil")
	}
	b.PutID(PushMessageContentAudioTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentAudio) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil")
	}
	if err := p.Audio.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentAudio#16be7872: field audio: %w", err)
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentAudio) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil")
	}
	if err := b.ConsumeID(PushMessageContentAudioTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentAudio) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil")
	}
	{
		if err := p.Audio.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field audio: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentAudio) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentAudio")
	b.Comma()
	b.FieldStart("audio")
	if err := p.Audio.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentAudio#16be7872: field audio: %w", err)
	}
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentAudio) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentAudio"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: %w", err)
			}
		case "audio":
			if err := p.Audio.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field audio: %w", err)
			}
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetAudio returns value of Audio field.
func (p *PushMessageContentAudio) GetAudio() (value Audio) {
	if p == nil {
		return
	}
	return p.Audio
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentAudio) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentContact represents TL type `pushMessageContentContact#ff458a54`.
type PushMessageContentContact struct {
	// Contact's name
	Name string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentContactTypeID is TL type id of PushMessageContentContact.
const PushMessageContentContactTypeID = 0xff458a54

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentContact) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentContact{}
)

func (p *PushMessageContentContact) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Name == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentContact) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentContact",
		ID:   PushMessageContentContactTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Name",
			SchemaName: "name",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentContact) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil")
	}
	b.PutID(PushMessageContentContactTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentContact) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil")
	}
	b.PutString(p.Name)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentContact) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil")
	}
	if err := b.ConsumeID(PushMessageContentContactTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentContact) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field name: %w", err)
		}
		p.Name = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentContact) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentContact")
	b.Comma()
	b.FieldStart("name")
	b.PutString(p.Name)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentContact) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentContact"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: %w", err)
			}
		case "name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field name: %w", err)
			}
			p.Name = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetName returns value of Name field.
func (p *PushMessageContentContact) GetName() (value string) {
	if p == nil {
		return
	}
	return p.Name
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentContact) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentContactRegistered represents TL type `pushMessageContentContactRegistered#ede1e5a0`.
type PushMessageContentContactRegistered struct {
}

// PushMessageContentContactRegisteredTypeID is TL type id of PushMessageContentContactRegistered.
const PushMessageContentContactRegisteredTypeID = 0xede1e5a0

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentContactRegistered) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentContactRegistered{}
)

func (p *PushMessageContentContactRegistered) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentContactRegistered) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentContactRegistered#ede1e5a0 as nil")
	}
	b.PutID(PushMessageContentContactRegisteredTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentContactRegistered) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentContactRegistered#ede1e5a0 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentContactRegistered) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil")
	}
	if err := b.ConsumeID(PushMessageContentContactRegisteredTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentContactRegistered#ede1e5a0: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentContactRegistered) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentContactRegistered) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil")
	}

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

// PushMessageContentDocument represents TL type `pushMessageContentDocument#e4adae01`.
type PushMessageContentDocument struct {
	// Message content; may be null
	Document Document
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentDocumentTypeID is TL type id of PushMessageContentDocument.
const PushMessageContentDocumentTypeID = 0xe4adae01

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentDocument) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentDocument{}
)

func (p *PushMessageContentDocument) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Document.Zero()) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentDocument) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentDocument",
		ID:   PushMessageContentDocumentTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Document",
			SchemaName: "document",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentDocument) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil")
	}
	b.PutID(PushMessageContentDocumentTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentDocument) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil")
	}
	if err := p.Document.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentDocument#e4adae01: field document: %w", err)
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentDocument) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil")
	}
	if err := b.ConsumeID(PushMessageContentDocumentTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentDocument) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil")
	}
	{
		if err := p.Document.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field document: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentDocument) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentDocument")
	b.Comma()
	b.FieldStart("document")
	if err := p.Document.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentDocument#e4adae01: field document: %w", err)
	}
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentDocument) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentDocument"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: %w", err)
			}
		case "document":
			if err := p.Document.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field document: %w", err)
			}
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetDocument returns value of Document field.
func (p *PushMessageContentDocument) GetDocument() (value Document) {
	if p == nil {
		return
	}
	return p.Document
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentDocument) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentGame represents TL type `pushMessageContentGame#e14bb91b`.
type PushMessageContentGame struct {
	// Game title, empty for pinned game message
	Title string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentGameTypeID is TL type id of PushMessageContentGame.
const PushMessageContentGameTypeID = 0xe14bb91b

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentGame) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentGame{}
)

func (p *PushMessageContentGame) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Title == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentGame) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentGame",
		ID:   PushMessageContentGameTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentGame) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil")
	}
	b.PutID(PushMessageContentGameTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentGame) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil")
	}
	b.PutString(p.Title)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentGame) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil")
	}
	if err := b.ConsumeID(PushMessageContentGameTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentGame) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field title: %w", err)
		}
		p.Title = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentGame) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentGame")
	b.Comma()
	b.FieldStart("title")
	b.PutString(p.Title)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentGame) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentGame"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: %w", err)
			}
		case "title":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field title: %w", err)
			}
			p.Title = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTitle returns value of Title field.
func (p *PushMessageContentGame) GetTitle() (value string) {
	if p == nil {
		return
	}
	return p.Title
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentGame) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentGameScore represents TL type `pushMessageContentGameScore#35b8cd88`.
type PushMessageContentGameScore struct {
	// Game title, empty for pinned message
	Title string
	// New score, 0 for pinned message
	Score int32
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentGameScoreTypeID is TL type id of PushMessageContentGameScore.
const PushMessageContentGameScoreTypeID = 0x35b8cd88

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentGameScore) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentGameScore{}
)

func (p *PushMessageContentGameScore) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Title == "") {
		return false
	}
	if !(p.Score == 0) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentGameScore) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentGameScore",
		ID:   PushMessageContentGameScoreTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Score",
			SchemaName: "score",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentGameScore) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil")
	}
	b.PutID(PushMessageContentGameScoreTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentGameScore) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil")
	}
	b.PutString(p.Title)
	b.PutInt32(p.Score)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentGameScore) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil")
	}
	if err := b.ConsumeID(PushMessageContentGameScoreTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentGameScore) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field title: %w", err)
		}
		p.Title = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field score: %w", err)
		}
		p.Score = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentGameScore) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentGameScore")
	b.Comma()
	b.FieldStart("title")
	b.PutString(p.Title)
	b.Comma()
	b.FieldStart("score")
	b.PutInt32(p.Score)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentGameScore) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentGameScore"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: %w", err)
			}
		case "title":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field title: %w", err)
			}
			p.Title = value
		case "score":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field score: %w", err)
			}
			p.Score = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTitle returns value of Title field.
func (p *PushMessageContentGameScore) GetTitle() (value string) {
	if p == nil {
		return
	}
	return p.Title
}

// GetScore returns value of Score field.
func (p *PushMessageContentGameScore) GetScore() (value int32) {
	if p == nil {
		return
	}
	return p.Score
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentGameScore) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentInvoice represents TL type `pushMessageContentInvoice#98c88bbc`.
type PushMessageContentInvoice struct {
	// Product price
	Price string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentInvoiceTypeID is TL type id of PushMessageContentInvoice.
const PushMessageContentInvoiceTypeID = 0x98c88bbc

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentInvoice) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentInvoice{}
)

func (p *PushMessageContentInvoice) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Price == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentInvoice) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentInvoice",
		ID:   PushMessageContentInvoiceTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Price",
			SchemaName: "price",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentInvoice) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil")
	}
	b.PutID(PushMessageContentInvoiceTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentInvoice) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil")
	}
	b.PutString(p.Price)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentInvoice) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil")
	}
	if err := b.ConsumeID(PushMessageContentInvoiceTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentInvoice) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field price: %w", err)
		}
		p.Price = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentInvoice) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentInvoice")
	b.Comma()
	b.FieldStart("price")
	b.PutString(p.Price)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentInvoice) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentInvoice"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: %w", err)
			}
		case "price":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field price: %w", err)
			}
			p.Price = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetPrice returns value of Price field.
func (p *PushMessageContentInvoice) GetPrice() (value string) {
	if p == nil {
		return
	}
	return p.Price
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentInvoice) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentLocation represents TL type `pushMessageContentLocation#b33a97b3`.
type PushMessageContentLocation struct {
	// True, if the location is live
	IsLive bool
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentLocationTypeID is TL type id of PushMessageContentLocation.
const PushMessageContentLocationTypeID = 0xb33a97b3

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentLocation) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentLocation{}
)

func (p *PushMessageContentLocation) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsLive == false) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentLocation) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentLocation",
		ID:   PushMessageContentLocationTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsLive",
			SchemaName: "is_live",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentLocation) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil")
	}
	b.PutID(PushMessageContentLocationTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentLocation) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil")
	}
	b.PutBool(p.IsLive)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentLocation) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil")
	}
	if err := b.ConsumeID(PushMessageContentLocationTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentLocation) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_live: %w", err)
		}
		p.IsLive = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentLocation) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentLocation")
	b.Comma()
	b.FieldStart("is_live")
	b.PutBool(p.IsLive)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentLocation) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentLocation"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: %w", err)
			}
		case "is_live":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_live: %w", err)
			}
			p.IsLive = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsLive returns value of IsLive field.
func (p *PushMessageContentLocation) GetIsLive() (value bool) {
	if p == nil {
		return
	}
	return p.IsLive
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentLocation) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentPaidMedia represents TL type `pushMessageContentPaidMedia#b556e74a`.
type PushMessageContentPaidMedia struct {
	// Number of Telegram Stars needed to buy access to the media in the message; 0 for
	// pinned message
	StarCount int64
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentPaidMediaTypeID is TL type id of PushMessageContentPaidMedia.
const PushMessageContentPaidMediaTypeID = 0xb556e74a

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentPaidMedia) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentPaidMedia{}
)

func (p *PushMessageContentPaidMedia) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.StarCount == 0) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentPaidMedia) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentPaidMedia",
		ID:   PushMessageContentPaidMediaTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "StarCount",
			SchemaName: "star_count",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentPaidMedia) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil")
	}
	b.PutID(PushMessageContentPaidMediaTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentPaidMedia) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil")
	}
	b.PutInt53(p.StarCount)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentPaidMedia) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil")
	}
	if err := b.ConsumeID(PushMessageContentPaidMediaTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentPaidMedia) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field star_count: %w", err)
		}
		p.StarCount = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentPaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentPaidMedia")
	b.Comma()
	b.FieldStart("star_count")
	b.PutInt53(p.StarCount)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentPaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentPaidMedia"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: %w", err)
			}
		case "star_count":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field star_count: %w", err)
			}
			p.StarCount = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetStarCount returns value of StarCount field.
func (p *PushMessageContentPaidMedia) GetStarCount() (value int64) {
	if p == nil {
		return
	}
	return p.StarCount
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentPaidMedia) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentPhoto represents TL type `pushMessageContentPhoto#861dc52`.
type PushMessageContentPhoto struct {
	// Message content; may be null
	Photo Photo
	// Photo caption
	Caption string
	// True, if the photo is secret
	IsSecret bool
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentPhotoTypeID is TL type id of PushMessageContentPhoto.
const PushMessageContentPhotoTypeID = 0x861dc52

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentPhoto) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentPhoto{}
)

func (p *PushMessageContentPhoto) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Photo.Zero()) {
		return false
	}
	if !(p.Caption == "") {
		return false
	}
	if !(p.IsSecret == false) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentPhoto) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentPhoto",
		ID:   PushMessageContentPhotoTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Photo",
			SchemaName: "photo",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
		{
			Name:       "IsSecret",
			SchemaName: "is_secret",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentPhoto) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil")
	}
	b.PutID(PushMessageContentPhotoTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentPhoto) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil")
	}
	if err := p.Photo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentPhoto#861dc52: field photo: %w", err)
	}
	b.PutString(p.Caption)
	b.PutBool(p.IsSecret)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentPhoto) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil")
	}
	if err := b.ConsumeID(PushMessageContentPhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentPhoto) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil")
	}
	{
		if err := p.Photo.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field photo: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field caption: %w", err)
		}
		p.Caption = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_secret: %w", err)
		}
		p.IsSecret = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentPhoto) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentPhoto")
	b.Comma()
	b.FieldStart("photo")
	if err := p.Photo.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentPhoto#861dc52: field photo: %w", err)
	}
	b.Comma()
	b.FieldStart("caption")
	b.PutString(p.Caption)
	b.Comma()
	b.FieldStart("is_secret")
	b.PutBool(p.IsSecret)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentPhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentPhoto"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: %w", err)
			}
		case "photo":
			if err := p.Photo.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field photo: %w", err)
			}
		case "caption":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field caption: %w", err)
			}
			p.Caption = value
		case "is_secret":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_secret: %w", err)
			}
			p.IsSecret = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetPhoto returns value of Photo field.
func (p *PushMessageContentPhoto) GetPhoto() (value Photo) {
	if p == nil {
		return
	}
	return p.Photo
}

// GetCaption returns value of Caption field.
func (p *PushMessageContentPhoto) GetCaption() (value string) {
	if p == nil {
		return
	}
	return p.Caption
}

// GetIsSecret returns value of IsSecret field.
func (p *PushMessageContentPhoto) GetIsSecret() (value bool) {
	if p == nil {
		return
	}
	return p.IsSecret
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentPhoto) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentPoll represents TL type `pushMessageContentPoll#fd5a743a`.
type PushMessageContentPoll struct {
	// Poll question
	Question string
	// True, if the poll is regular and not in quiz mode
	IsRegular bool
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentPollTypeID is TL type id of PushMessageContentPoll.
const PushMessageContentPollTypeID = 0xfd5a743a

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentPoll) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentPoll{}
)

func (p *PushMessageContentPoll) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Question == "") {
		return false
	}
	if !(p.IsRegular == false) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentPoll) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentPoll",
		ID:   PushMessageContentPollTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Question",
			SchemaName: "question",
		},
		{
			Name:       "IsRegular",
			SchemaName: "is_regular",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentPoll) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil")
	}
	b.PutID(PushMessageContentPollTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentPoll) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil")
	}
	b.PutString(p.Question)
	b.PutBool(p.IsRegular)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentPoll) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil")
	}
	if err := b.ConsumeID(PushMessageContentPollTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentPoll) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field question: %w", err)
		}
		p.Question = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_regular: %w", err)
		}
		p.IsRegular = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentPoll) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentPoll")
	b.Comma()
	b.FieldStart("question")
	b.PutString(p.Question)
	b.Comma()
	b.FieldStart("is_regular")
	b.PutBool(p.IsRegular)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentPoll) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentPoll"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: %w", err)
			}
		case "question":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field question: %w", err)
			}
			p.Question = value
		case "is_regular":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_regular: %w", err)
			}
			p.IsRegular = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetQuestion returns value of Question field.
func (p *PushMessageContentPoll) GetQuestion() (value string) {
	if p == nil {
		return
	}
	return p.Question
}

// GetIsRegular returns value of IsRegular field.
func (p *PushMessageContentPoll) GetIsRegular() (value bool) {
	if p == nil {
		return
	}
	return p.IsRegular
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentPoll) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentPremiumGiftCode represents TL type `pushMessageContentPremiumGiftCode#18a15025`.
type PushMessageContentPremiumGiftCode struct {
	// Number of months the Telegram Premium subscription will be active after code
	// activation
	MonthCount int32
}

// PushMessageContentPremiumGiftCodeTypeID is TL type id of PushMessageContentPremiumGiftCode.
const PushMessageContentPremiumGiftCodeTypeID = 0x18a15025

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentPremiumGiftCode) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentPremiumGiftCode{}
)

func (p *PushMessageContentPremiumGiftCode) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.MonthCount == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentPremiumGiftCode) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentPremiumGiftCode",
		ID:   PushMessageContentPremiumGiftCodeTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MonthCount",
			SchemaName: "month_count",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentPremiumGiftCode) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil")
	}
	b.PutID(PushMessageContentPremiumGiftCodeTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentPremiumGiftCode) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil")
	}
	b.PutInt32(p.MonthCount)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentPremiumGiftCode) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil")
	}
	if err := b.ConsumeID(PushMessageContentPremiumGiftCodeTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentPremiumGiftCode) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: field month_count: %w", err)
		}
		p.MonthCount = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentPremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentPremiumGiftCode")
	b.Comma()
	b.FieldStart("month_count")
	b.PutInt32(p.MonthCount)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentPremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentPremiumGiftCode"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: %w", err)
			}
		case "month_count":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: field month_count: %w", err)
			}
			p.MonthCount = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMonthCount returns value of MonthCount field.
func (p *PushMessageContentPremiumGiftCode) GetMonthCount() (value int32) {
	if p == nil {
		return
	}
	return p.MonthCount
}

// PushMessageContentGiveaway represents TL type `pushMessageContentGiveaway#d63e7f8e`.
type PushMessageContentGiveaway struct {
	// Number of users which will receive giveaway prizes; 0 for pinned message
	WinnerCount int32
	// Prize of the giveaway; may be null for pinned message
	Prize GiveawayPrizeClass
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentGiveawayTypeID is TL type id of PushMessageContentGiveaway.
const PushMessageContentGiveawayTypeID = 0xd63e7f8e

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentGiveaway) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentGiveaway{}
)

func (p *PushMessageContentGiveaway) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.WinnerCount == 0) {
		return false
	}
	if !(p.Prize == nil) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentGiveaway) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentGiveaway",
		ID:   PushMessageContentGiveawayTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "WinnerCount",
			SchemaName: "winner_count",
		},
		{
			Name:       "Prize",
			SchemaName: "prize",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentGiveaway) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil")
	}
	b.PutID(PushMessageContentGiveawayTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentGiveaway) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil")
	}
	b.PutInt32(p.WinnerCount)
	if p.Prize == nil {
		return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil")
	}
	if err := p.Prize.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err)
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentGiveaway) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil")
	}
	if err := b.ConsumeID(PushMessageContentGiveawayTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentGiveaway) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err)
		}
		p.WinnerCount = value
	}
	{
		value, err := DecodeGiveawayPrize(b)
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err)
		}
		p.Prize = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentGiveaway")
	b.Comma()
	b.FieldStart("winner_count")
	b.PutInt32(p.WinnerCount)
	b.Comma()
	b.FieldStart("prize")
	if p.Prize == nil {
		return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil")
	}
	if err := p.Prize.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err)
	}
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentGiveaway"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err)
			}
		case "winner_count":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err)
			}
			p.WinnerCount = value
		case "prize":
			value, err := DecodeTDLibJSONGiveawayPrize(b)
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err)
			}
			p.Prize = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetWinnerCount returns value of WinnerCount field.
func (p *PushMessageContentGiveaway) GetWinnerCount() (value int32) {
	if p == nil {
		return
	}
	return p.WinnerCount
}

// GetPrize returns value of Prize field.
func (p *PushMessageContentGiveaway) GetPrize() (value GiveawayPrizeClass) {
	if p == nil {
		return
	}
	return p.Prize
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentGiveaway) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentGift represents TL type `pushMessageContentGift#84a8cd0b`.
type PushMessageContentGift struct {
	// Number of Telegram Stars that sender paid for the gift
	StarCount int64
}

// PushMessageContentGiftTypeID is TL type id of PushMessageContentGift.
const PushMessageContentGiftTypeID = 0x84a8cd0b

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentGift) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentGift{}
)

func (p *PushMessageContentGift) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.StarCount == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentGift) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentGift",
		ID:   PushMessageContentGiftTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "StarCount",
			SchemaName: "star_count",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentGift) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil")
	}
	b.PutID(PushMessageContentGiftTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentGift) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil")
	}
	b.PutInt53(p.StarCount)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentGift) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil")
	}
	if err := b.ConsumeID(PushMessageContentGiftTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentGift) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: field star_count: %w", err)
		}
		p.StarCount = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentGift) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentGift")
	b.Comma()
	b.FieldStart("star_count")
	b.PutInt53(p.StarCount)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentGift) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentGift"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: %w", err)
			}
		case "star_count":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: field star_count: %w", err)
			}
			p.StarCount = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetStarCount returns value of StarCount field.
func (p *PushMessageContentGift) GetStarCount() (value int64) {
	if p == nil {
		return
	}
	return p.StarCount
}

// PushMessageContentUpgradedGift represents TL type `pushMessageContentUpgradedGift#99fa0ade`.
type PushMessageContentUpgradedGift struct {
	// True, if the gift was obtained by upgrading of a previously received gift; otherwise,
	// this is a transferred or resold gift
	IsUpgrade bool
}

// PushMessageContentUpgradedGiftTypeID is TL type id of PushMessageContentUpgradedGift.
const PushMessageContentUpgradedGiftTypeID = 0x99fa0ade

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentUpgradedGift) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentUpgradedGift{}
)

func (p *PushMessageContentUpgradedGift) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsUpgrade == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentUpgradedGift) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentUpgradedGift",
		ID:   PushMessageContentUpgradedGiftTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsUpgrade",
			SchemaName: "is_upgrade",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentUpgradedGift) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil")
	}
	b.PutID(PushMessageContentUpgradedGiftTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentUpgradedGift) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil")
	}
	b.PutBool(p.IsUpgrade)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentUpgradedGift) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil")
	}
	if err := b.ConsumeID(PushMessageContentUpgradedGiftTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentUpgradedGift) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err)
		}
		p.IsUpgrade = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentUpgradedGift")
	b.Comma()
	b.FieldStart("is_upgrade")
	b.PutBool(p.IsUpgrade)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentUpgradedGift"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err)
			}
		case "is_upgrade":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err)
			}
			p.IsUpgrade = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsUpgrade returns value of IsUpgrade field.
func (p *PushMessageContentUpgradedGift) GetIsUpgrade() (value bool) {
	if p == nil {
		return
	}
	return p.IsUpgrade
}

// PushMessageContentScreenshotTaken represents TL type `pushMessageContentScreenshotTaken#cc51ff9`.
type PushMessageContentScreenshotTaken struct {
}

// PushMessageContentScreenshotTakenTypeID is TL type id of PushMessageContentScreenshotTaken.
const PushMessageContentScreenshotTakenTypeID = 0xcc51ff9

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentScreenshotTaken) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentScreenshotTaken{}
)

func (p *PushMessageContentScreenshotTaken) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentScreenshotTaken) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentScreenshotTaken#cc51ff9 as nil")
	}
	b.PutID(PushMessageContentScreenshotTakenTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentScreenshotTaken) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentScreenshotTaken#cc51ff9 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentScreenshotTaken) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil")
	}
	if err := b.ConsumeID(PushMessageContentScreenshotTakenTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentScreenshotTaken#cc51ff9: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentScreenshotTaken) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentScreenshotTaken) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil")
	}

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

// PushMessageContentSticker represents TL type `pushMessageContentSticker#5c98bdd3`.
type PushMessageContentSticker struct {
	// Message content; may be null
	Sticker Sticker
	// Emoji corresponding to the sticker; may be empty
	Emoji string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentStickerTypeID is TL type id of PushMessageContentSticker.
const PushMessageContentStickerTypeID = 0x5c98bdd3

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentSticker) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentSticker{}
)

func (p *PushMessageContentSticker) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Sticker.Zero()) {
		return false
	}
	if !(p.Emoji == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentSticker) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentSticker",
		ID:   PushMessageContentStickerTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Sticker",
			SchemaName: "sticker",
		},
		{
			Name:       "Emoji",
			SchemaName: "emoji",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentSticker) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil")
	}
	b.PutID(PushMessageContentStickerTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentSticker) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil")
	}
	if err := p.Sticker.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentSticker#5c98bdd3: field sticker: %w", err)
	}
	b.PutString(p.Emoji)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentSticker) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil")
	}
	if err := b.ConsumeID(PushMessageContentStickerTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentSticker) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil")
	}
	{
		if err := p.Sticker.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field sticker: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field emoji: %w", err)
		}
		p.Emoji = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentSticker) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentSticker")
	b.Comma()
	b.FieldStart("sticker")
	if err := p.Sticker.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentSticker#5c98bdd3: field sticker: %w", err)
	}
	b.Comma()
	b.FieldStart("emoji")
	b.PutString(p.Emoji)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentSticker) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentSticker"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: %w", err)
			}
		case "sticker":
			if err := p.Sticker.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field sticker: %w", err)
			}
		case "emoji":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field emoji: %w", err)
			}
			p.Emoji = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetSticker returns value of Sticker field.
func (p *PushMessageContentSticker) GetSticker() (value Sticker) {
	if p == nil {
		return
	}
	return p.Sticker
}

// GetEmoji returns value of Emoji field.
func (p *PushMessageContentSticker) GetEmoji() (value string) {
	if p == nil {
		return
	}
	return p.Emoji
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentSticker) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentStory represents TL type `pushMessageContentStory#23bd824f`.
type PushMessageContentStory struct {
	// True, if the user was mentioned in the story
	IsMention bool
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentStoryTypeID is TL type id of PushMessageContentStory.
const PushMessageContentStoryTypeID = 0x23bd824f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentStory) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentStory{}
)

func (p *PushMessageContentStory) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsMention == false) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentStory) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentStory",
		ID:   PushMessageContentStoryTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsMention",
			SchemaName: "is_mention",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentStory) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentStory#23bd824f as nil")
	}
	b.PutID(PushMessageContentStoryTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentStory) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentStory#23bd824f as nil")
	}
	b.PutBool(p.IsMention)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentStory) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentStory#23bd824f to nil")
	}
	if err := b.ConsumeID(PushMessageContentStoryTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentStory) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentStory#23bd824f to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: field is_mention: %w", err)
		}
		p.IsMention = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentStory) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentStory#23bd824f as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentStory")
	b.Comma()
	b.FieldStart("is_mention")
	b.PutBool(p.IsMention)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentStory) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentStory#23bd824f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentStory"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: %w", err)
			}
		case "is_mention":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: field is_mention: %w", err)
			}
			p.IsMention = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentStory#23bd824f: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsMention returns value of IsMention field.
func (p *PushMessageContentStory) GetIsMention() (value bool) {
	if p == nil {
		return
	}
	return p.IsMention
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentStory) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentText represents TL type `pushMessageContentText#105ddea9`.
type PushMessageContentText struct {
	// Message text
	Text string
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentTextTypeID is TL type id of PushMessageContentText.
const PushMessageContentTextTypeID = 0x105ddea9

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentText) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentText{}
)

func (p *PushMessageContentText) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Text == "") {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentText) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentText",
		ID:   PushMessageContentTextTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentText) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil")
	}
	b.PutID(PushMessageContentTextTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentText) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil")
	}
	b.PutString(p.Text)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentText) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil")
	}
	if err := b.ConsumeID(PushMessageContentTextTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentText) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field text: %w", err)
		}
		p.Text = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentText) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentText")
	b.Comma()
	b.FieldStart("text")
	b.PutString(p.Text)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentText) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentText"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: %w", err)
			}
		case "text":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field text: %w", err)
			}
			p.Text = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetText returns value of Text field.
func (p *PushMessageContentText) GetText() (value string) {
	if p == nil {
		return
	}
	return p.Text
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentText) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentVideo represents TL type `pushMessageContentVideo#127ad12f`.
type PushMessageContentVideo struct {
	// Message content; may be null
	Video Video
	// Video caption
	Caption string
	// True, if the video is secret
	IsSecret bool
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentVideoTypeID is TL type id of PushMessageContentVideo.
const PushMessageContentVideoTypeID = 0x127ad12f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentVideo) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentVideo{}
)

func (p *PushMessageContentVideo) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Video.Zero()) {
		return false
	}
	if !(p.Caption == "") {
		return false
	}
	if !(p.IsSecret == false) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentVideo) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentVideo",
		ID:   PushMessageContentVideoTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Video",
			SchemaName: "video",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
		{
			Name:       "IsSecret",
			SchemaName: "is_secret",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentVideo) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil")
	}
	b.PutID(PushMessageContentVideoTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentVideo) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil")
	}
	if err := p.Video.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVideo#127ad12f: field video: %w", err)
	}
	b.PutString(p.Caption)
	b.PutBool(p.IsSecret)
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentVideo) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil")
	}
	if err := b.ConsumeID(PushMessageContentVideoTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentVideo) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil")
	}
	{
		if err := p.Video.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field video: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field caption: %w", err)
		}
		p.Caption = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_secret: %w", err)
		}
		p.IsSecret = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentVideo")
	b.Comma()
	b.FieldStart("video")
	if err := p.Video.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVideo#127ad12f: field video: %w", err)
	}
	b.Comma()
	b.FieldStart("caption")
	b.PutString(p.Caption)
	b.Comma()
	b.FieldStart("is_secret")
	b.PutBool(p.IsSecret)
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentVideo) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentVideo"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: %w", err)
			}
		case "video":
			if err := p.Video.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field video: %w", err)
			}
		case "caption":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field caption: %w", err)
			}
			p.Caption = value
		case "is_secret":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_secret: %w", err)
			}
			p.IsSecret = value
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetVideo returns value of Video field.
func (p *PushMessageContentVideo) GetVideo() (value Video) {
	if p == nil {
		return
	}
	return p.Video
}

// GetCaption returns value of Caption field.
func (p *PushMessageContentVideo) GetCaption() (value string) {
	if p == nil {
		return
	}
	return p.Caption
}

// GetIsSecret returns value of IsSecret field.
func (p *PushMessageContentVideo) GetIsSecret() (value bool) {
	if p == nil {
		return
	}
	return p.IsSecret
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentVideo) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentVideoNote represents TL type `pushMessageContentVideoNote#bd13f97f`.
type PushMessageContentVideoNote struct {
	// Message content; may be null
	VideoNote VideoNote
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentVideoNoteTypeID is TL type id of PushMessageContentVideoNote.
const PushMessageContentVideoNoteTypeID = 0xbd13f97f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentVideoNote) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentVideoNote{}
)

func (p *PushMessageContentVideoNote) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.VideoNote.Zero()) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentVideoNote) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentVideoNote",
		ID:   PushMessageContentVideoNoteTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "VideoNote",
			SchemaName: "video_note",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentVideoNote) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil")
	}
	b.PutID(PushMessageContentVideoNoteTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentVideoNote) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil")
	}
	if err := p.VideoNote.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err)
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentVideoNote) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil")
	}
	if err := b.ConsumeID(PushMessageContentVideoNoteTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentVideoNote) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil")
	}
	{
		if err := p.VideoNote.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentVideoNote")
	b.Comma()
	b.FieldStart("video_note")
	if err := p.VideoNote.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err)
	}
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentVideoNote"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: %w", err)
			}
		case "video_note":
			if err := p.VideoNote.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err)
			}
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetVideoNote returns value of VideoNote field.
func (p *PushMessageContentVideoNote) GetVideoNote() (value VideoNote) {
	if p == nil {
		return
	}
	return p.VideoNote
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentVideoNote) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentVoiceNote represents TL type `pushMessageContentVoiceNote#54cac8b`.
type PushMessageContentVoiceNote struct {
	// Message content; may be null
	VoiceNote VoiceNote
	// True, if the message is a pinned message with the specified content
	IsPinned bool
}

// PushMessageContentVoiceNoteTypeID is TL type id of PushMessageContentVoiceNote.
const PushMessageContentVoiceNoteTypeID = 0x54cac8b

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentVoiceNote) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentVoiceNote{}
)

func (p *PushMessageContentVoiceNote) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.VoiceNote.Zero()) {
		return false
	}
	if !(p.IsPinned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentVoiceNote) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentVoiceNote",
		ID:   PushMessageContentVoiceNoteTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "VoiceNote",
			SchemaName: "voice_note",
		},
		{
			Name:       "IsPinned",
			SchemaName: "is_pinned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentVoiceNote) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil")
	}
	b.PutID(PushMessageContentVoiceNoteTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentVoiceNote) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil")
	}
	if err := p.VoiceNote.Encode(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err)
	}
	b.PutBool(p.IsPinned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentVoiceNote) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil")
	}
	if err := b.ConsumeID(PushMessageContentVoiceNoteTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentVoiceNote) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil")
	}
	{
		if err := p.VoiceNote.Decode(b); err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field is_pinned: %w", err)
		}
		p.IsPinned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentVoiceNote")
	b.Comma()
	b.FieldStart("voice_note")
	if err := p.VoiceNote.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err)
	}
	b.Comma()
	b.FieldStart("is_pinned")
	b.PutBool(p.IsPinned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentVoiceNote"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: %w", err)
			}
		case "voice_note":
			if err := p.VoiceNote.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err)
			}
		case "is_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field is_pinned: %w", err)
			}
			p.IsPinned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetVoiceNote returns value of VoiceNote field.
func (p *PushMessageContentVoiceNote) GetVoiceNote() (value VoiceNote) {
	if p == nil {
		return
	}
	return p.VoiceNote
}

// GetIsPinned returns value of IsPinned field.
func (p *PushMessageContentVoiceNote) GetIsPinned() (value bool) {
	if p == nil {
		return
	}
	return p.IsPinned
}

// PushMessageContentBasicGroupChatCreate represents TL type `pushMessageContentBasicGroupChatCreate#81f1defc`.
type PushMessageContentBasicGroupChatCreate struct {
}

// PushMessageContentBasicGroupChatCreateTypeID is TL type id of PushMessageContentBasicGroupChatCreate.
const PushMessageContentBasicGroupChatCreateTypeID = 0x81f1defc

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentBasicGroupChatCreate) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentBasicGroupChatCreate{}
)

func (p *PushMessageContentBasicGroupChatCreate) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentBasicGroupChatCreate) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil")
	}
	b.PutID(PushMessageContentBasicGroupChatCreateTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentBasicGroupChatCreate) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentBasicGroupChatCreate) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil")
	}
	if err := b.ConsumeID(PushMessageContentBasicGroupChatCreateTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentBasicGroupChatCreate#81f1defc: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentBasicGroupChatCreate) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentBasicGroupChatCreate) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentBasicGroupChatCreate")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentBasicGroupChatCreate) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil")
	}

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

// PushMessageContentVideoChatStarted represents TL type `pushMessageContentVideoChatStarted#de3b2c3f`.
type PushMessageContentVideoChatStarted struct {
}

// PushMessageContentVideoChatStartedTypeID is TL type id of PushMessageContentVideoChatStarted.
const PushMessageContentVideoChatStartedTypeID = 0xde3b2c3f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentVideoChatStarted) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentVideoChatStarted{}
)

func (p *PushMessageContentVideoChatStarted) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentVideoChatStarted) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoChatStarted#de3b2c3f as nil")
	}
	b.PutID(PushMessageContentVideoChatStartedTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentVideoChatStarted) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoChatStarted#de3b2c3f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentVideoChatStarted) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatStarted#de3b2c3f to nil")
	}
	if err := b.ConsumeID(PushMessageContentVideoChatStartedTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentVideoChatStarted#de3b2c3f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentVideoChatStarted) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatStarted#de3b2c3f to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentVideoChatStarted) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatStarted#de3b2c3f to nil")
	}

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

// PushMessageContentVideoChatEnded represents TL type `pushMessageContentVideoChatEnded#b57a74e3`.
type PushMessageContentVideoChatEnded struct {
}

// PushMessageContentVideoChatEndedTypeID is TL type id of PushMessageContentVideoChatEnded.
const PushMessageContentVideoChatEndedTypeID = 0xb57a74e3

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentVideoChatEnded) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentVideoChatEnded{}
)

func (p *PushMessageContentVideoChatEnded) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentVideoChatEnded) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoChatEnded#b57a74e3 as nil")
	}
	b.PutID(PushMessageContentVideoChatEndedTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentVideoChatEnded) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentVideoChatEnded#b57a74e3 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentVideoChatEnded) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatEnded#b57a74e3 to nil")
	}
	if err := b.ConsumeID(PushMessageContentVideoChatEndedTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentVideoChatEnded#b57a74e3: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentVideoChatEnded) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatEnded#b57a74e3 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentVideoChatEnded#b57a74e3 to nil")
	}

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

// PushMessageContentInviteVideoChatParticipants represents TL type `pushMessageContentInviteVideoChatParticipants#1eda428d`.
type PushMessageContentInviteVideoChatParticipants struct {
	// True, if the current user was invited to the video chat or the live stream
	IsCurrentUser bool
}

// PushMessageContentInviteVideoChatParticipantsTypeID is TL type id of PushMessageContentInviteVideoChatParticipants.
const PushMessageContentInviteVideoChatParticipantsTypeID = 0x1eda428d

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentInviteVideoChatParticipants) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentInviteVideoChatParticipants{}
)

func (p *PushMessageContentInviteVideoChatParticipants) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsCurrentUser == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentInviteVideoChatParticipants) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentInviteVideoChatParticipants",
		ID:   PushMessageContentInviteVideoChatParticipantsTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsCurrentUser",
			SchemaName: "is_current_user",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentInviteVideoChatParticipants) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInviteVideoChatParticipants#1eda428d as nil")
	}
	b.PutID(PushMessageContentInviteVideoChatParticipantsTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentInviteVideoChatParticipants) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInviteVideoChatParticipants#1eda428d as nil")
	}
	b.PutBool(p.IsCurrentUser)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentInviteVideoChatParticipants) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInviteVideoChatParticipants#1eda428d to nil")
	}
	if err := b.ConsumeID(PushMessageContentInviteVideoChatParticipantsTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentInviteVideoChatParticipants#1eda428d: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentInviteVideoChatParticipants) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInviteVideoChatParticipants#1eda428d to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentInviteVideoChatParticipants#1eda428d: field is_current_user: %w", err)
		}
		p.IsCurrentUser = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentInviteVideoChatParticipants) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentInviteVideoChatParticipants#1eda428d as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentInviteVideoChatParticipants")
	b.Comma()
	b.FieldStart("is_current_user")
	b.PutBool(p.IsCurrentUser)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentInviteVideoChatParticipants) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentInviteVideoChatParticipants#1eda428d to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentInviteVideoChatParticipants"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentInviteVideoChatParticipants#1eda428d: %w", err)
			}
		case "is_current_user":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentInviteVideoChatParticipants#1eda428d: field is_current_user: %w", err)
			}
			p.IsCurrentUser = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetIsCurrentUser returns value of IsCurrentUser field.
func (p *PushMessageContentInviteVideoChatParticipants) GetIsCurrentUser() (value bool) {
	if p == nil {
		return
	}
	return p.IsCurrentUser
}

// PushMessageContentChatAddMembers represents TL type `pushMessageContentChatAddMembers#bf337b3a`.
type PushMessageContentChatAddMembers struct {
	// Name of the added member
	MemberName string
	// True, if the current user was added to the group
	IsCurrentUser bool
	// True, if the user has returned to the group themselves
	IsReturned bool
}

// PushMessageContentChatAddMembersTypeID is TL type id of PushMessageContentChatAddMembers.
const PushMessageContentChatAddMembersTypeID = 0xbf337b3a

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatAddMembers) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatAddMembers{}
)

func (p *PushMessageContentChatAddMembers) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.MemberName == "") {
		return false
	}
	if !(p.IsCurrentUser == false) {
		return false
	}
	if !(p.IsReturned == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentChatAddMembers) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentChatAddMembers",
		ID:   PushMessageContentChatAddMembersTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MemberName",
			SchemaName: "member_name",
		},
		{
			Name:       "IsCurrentUser",
			SchemaName: "is_current_user",
		},
		{
			Name:       "IsReturned",
			SchemaName: "is_returned",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentChatAddMembers) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil")
	}
	b.PutID(PushMessageContentChatAddMembersTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatAddMembers) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil")
	}
	b.PutString(p.MemberName)
	b.PutBool(p.IsCurrentUser)
	b.PutBool(p.IsReturned)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatAddMembers) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatAddMembersTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatAddMembers) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field member_name: %w", err)
		}
		p.MemberName = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_current_user: %w", err)
		}
		p.IsCurrentUser = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_returned: %w", err)
		}
		p.IsReturned = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatAddMembers) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatAddMembers")
	b.Comma()
	b.FieldStart("member_name")
	b.PutString(p.MemberName)
	b.Comma()
	b.FieldStart("is_current_user")
	b.PutBool(p.IsCurrentUser)
	b.Comma()
	b.FieldStart("is_returned")
	b.PutBool(p.IsReturned)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatAddMembers) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentChatAddMembers"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: %w", err)
			}
		case "member_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field member_name: %w", err)
			}
			p.MemberName = value
		case "is_current_user":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_current_user: %w", err)
			}
			p.IsCurrentUser = value
		case "is_returned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_returned: %w", err)
			}
			p.IsReturned = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMemberName returns value of MemberName field.
func (p *PushMessageContentChatAddMembers) GetMemberName() (value string) {
	if p == nil {
		return
	}
	return p.MemberName
}

// GetIsCurrentUser returns value of IsCurrentUser field.
func (p *PushMessageContentChatAddMembers) GetIsCurrentUser() (value bool) {
	if p == nil {
		return
	}
	return p.IsCurrentUser
}

// GetIsReturned returns value of IsReturned field.
func (p *PushMessageContentChatAddMembers) GetIsReturned() (value bool) {
	if p == nil {
		return
	}
	return p.IsReturned
}

// PushMessageContentChatChangePhoto represents TL type `pushMessageContentChatChangePhoto#bd96521d`.
type PushMessageContentChatChangePhoto struct {
}

// PushMessageContentChatChangePhotoTypeID is TL type id of PushMessageContentChatChangePhoto.
const PushMessageContentChatChangePhotoTypeID = 0xbd96521d

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatChangePhoto) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatChangePhoto{}
)

func (p *PushMessageContentChatChangePhoto) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentChatChangePhoto) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatChangePhoto#bd96521d as nil")
	}
	b.PutID(PushMessageContentChatChangePhotoTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatChangePhoto) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatChangePhoto#bd96521d as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatChangePhoto) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatChangePhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatChangePhoto#bd96521d: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatChangePhoto) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatChangePhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil")
	}

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

// PushMessageContentChatChangeTitle represents TL type `pushMessageContentChatChangeTitle#8ae1f6a3`.
type PushMessageContentChatChangeTitle struct {
	// New chat title
	Title string
}

// PushMessageContentChatChangeTitleTypeID is TL type id of PushMessageContentChatChangeTitle.
const PushMessageContentChatChangeTitleTypeID = 0x8ae1f6a3

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatChangeTitle) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatChangeTitle{}
)

func (p *PushMessageContentChatChangeTitle) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Title == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentChatChangeTitle) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentChatChangeTitle",
		ID:   PushMessageContentChatChangeTitleTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentChatChangeTitle) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil")
	}
	b.PutID(PushMessageContentChatChangeTitleTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatChangeTitle) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil")
	}
	b.PutString(p.Title)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatChangeTitle) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatChangeTitleTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatChangeTitle) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: field title: %w", err)
		}
		p.Title = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatChangeTitle) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatChangeTitle")
	b.Comma()
	b.FieldStart("title")
	b.PutString(p.Title)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatChangeTitle) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentChatChangeTitle"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: %w", err)
			}
		case "title":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: field title: %w", err)
			}
			p.Title = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTitle returns value of Title field.
func (p *PushMessageContentChatChangeTitle) GetTitle() (value string) {
	if p == nil {
		return
	}
	return p.Title
}

// PushMessageContentChatSetBackground represents TL type `pushMessageContentChatSetBackground#a72b56e3`.
type PushMessageContentChatSetBackground struct {
	// True, if the set background is the same as the background of the current user
	IsSame bool
}

// PushMessageContentChatSetBackgroundTypeID is TL type id of PushMessageContentChatSetBackground.
const PushMessageContentChatSetBackgroundTypeID = 0xa72b56e3

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatSetBackground) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatSetBackground{}
)

func (p *PushMessageContentChatSetBackground) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.IsSame == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentChatSetBackground) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentChatSetBackground",
		ID:   PushMessageContentChatSetBackgroundTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "IsSame",
			SchemaName: "is_same",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentChatSetBackground) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil")
	}
	b.PutID(PushMessageContentChatSetBackgroundTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatSetBackground) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil")
	}
	b.PutBool(p.IsSame)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatSetBackground) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatSetBackgroundTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatSetBackground) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: field is_same: %w", err)
		}
		p.IsSame = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatSetBackground")
	b.Comma()
	b.FieldStart("is_same")
	b.PutBool(p.IsSame)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatSetBackground) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil")
	}

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

// GetIsSame returns value of IsSame field.
func (p *PushMessageContentChatSetBackground) GetIsSame() (value bool) {
	if p == nil {
		return
	}
	return p.IsSame
}

// PushMessageContentChatSetTheme represents TL type `pushMessageContentChatSetTheme#a5d3b68`.
type PushMessageContentChatSetTheme struct {
	// If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was
	// reset to the default one
	ThemeName string
}

// PushMessageContentChatSetThemeTypeID is TL type id of PushMessageContentChatSetTheme.
const PushMessageContentChatSetThemeTypeID = 0xa5d3b68

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatSetTheme) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatSetTheme{}
)

func (p *PushMessageContentChatSetTheme) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.ThemeName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentChatSetTheme) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentChatSetTheme",
		ID:   PushMessageContentChatSetThemeTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ThemeName",
			SchemaName: "theme_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentChatSetTheme) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil")
	}
	b.PutID(PushMessageContentChatSetThemeTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatSetTheme) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil")
	}
	b.PutString(p.ThemeName)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatSetTheme) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatSetThemeTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatSetTheme) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: field theme_name: %w", err)
		}
		p.ThemeName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatSetTheme) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatSetTheme")
	b.Comma()
	b.FieldStart("theme_name")
	b.PutString(p.ThemeName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatSetTheme) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil")
	}

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

// GetThemeName returns value of ThemeName field.
func (p *PushMessageContentChatSetTheme) GetThemeName() (value string) {
	if p == nil {
		return
	}
	return p.ThemeName
}

// PushMessageContentChatDeleteMember represents TL type `pushMessageContentChatDeleteMember#23afa99f`.
type PushMessageContentChatDeleteMember struct {
	// Name of the deleted member
	MemberName string
	// True, if the current user was deleted from the group
	IsCurrentUser bool
	// True, if the user has left the group themselves
	IsLeft bool
}

// PushMessageContentChatDeleteMemberTypeID is TL type id of PushMessageContentChatDeleteMember.
const PushMessageContentChatDeleteMemberTypeID = 0x23afa99f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatDeleteMember) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatDeleteMember{}
)

func (p *PushMessageContentChatDeleteMember) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.MemberName == "") {
		return false
	}
	if !(p.IsCurrentUser == false) {
		return false
	}
	if !(p.IsLeft == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentChatDeleteMember) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentChatDeleteMember",
		ID:   PushMessageContentChatDeleteMemberTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MemberName",
			SchemaName: "member_name",
		},
		{
			Name:       "IsCurrentUser",
			SchemaName: "is_current_user",
		},
		{
			Name:       "IsLeft",
			SchemaName: "is_left",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentChatDeleteMember) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil")
	}
	b.PutID(PushMessageContentChatDeleteMemberTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatDeleteMember) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil")
	}
	b.PutString(p.MemberName)
	b.PutBool(p.IsCurrentUser)
	b.PutBool(p.IsLeft)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatDeleteMember) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatDeleteMemberTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatDeleteMember) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field member_name: %w", err)
		}
		p.MemberName = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_current_user: %w", err)
		}
		p.IsCurrentUser = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_left: %w", err)
		}
		p.IsLeft = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatDeleteMember) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatDeleteMember")
	b.Comma()
	b.FieldStart("member_name")
	b.PutString(p.MemberName)
	b.Comma()
	b.FieldStart("is_current_user")
	b.PutBool(p.IsCurrentUser)
	b.Comma()
	b.FieldStart("is_left")
	b.PutBool(p.IsLeft)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatDeleteMember) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentChatDeleteMember"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: %w", err)
			}
		case "member_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field member_name: %w", err)
			}
			p.MemberName = value
		case "is_current_user":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_current_user: %w", err)
			}
			p.IsCurrentUser = value
		case "is_left":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_left: %w", err)
			}
			p.IsLeft = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMemberName returns value of MemberName field.
func (p *PushMessageContentChatDeleteMember) GetMemberName() (value string) {
	if p == nil {
		return
	}
	return p.MemberName
}

// GetIsCurrentUser returns value of IsCurrentUser field.
func (p *PushMessageContentChatDeleteMember) GetIsCurrentUser() (value bool) {
	if p == nil {
		return
	}
	return p.IsCurrentUser
}

// GetIsLeft returns value of IsLeft field.
func (p *PushMessageContentChatDeleteMember) GetIsLeft() (value bool) {
	if p == nil {
		return
	}
	return p.IsLeft
}

// PushMessageContentChatJoinByLink represents TL type `pushMessageContentChatJoinByLink#5c9bdf49`.
type PushMessageContentChatJoinByLink struct {
}

// PushMessageContentChatJoinByLinkTypeID is TL type id of PushMessageContentChatJoinByLink.
const PushMessageContentChatJoinByLinkTypeID = 0x5c9bdf49

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatJoinByLink) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatJoinByLink{}
)

func (p *PushMessageContentChatJoinByLink) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentChatJoinByLink) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil")
	}
	b.PutID(PushMessageContentChatJoinByLinkTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatJoinByLink) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatJoinByLink) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatJoinByLinkTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatJoinByLink#5c9bdf49: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatJoinByLink) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentChatJoinByLink) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentChatJoinByLink")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatJoinByLink) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil")
	}

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

// PushMessageContentChatJoinByRequest represents TL type `pushMessageContentChatJoinByRequest#f3bb6175`.
type PushMessageContentChatJoinByRequest struct {
}

// PushMessageContentChatJoinByRequestTypeID is TL type id of PushMessageContentChatJoinByRequest.
const PushMessageContentChatJoinByRequestTypeID = 0xf3bb6175

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentChatJoinByRequest) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentChatJoinByRequest{}
)

func (p *PushMessageContentChatJoinByRequest) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentChatJoinByRequest) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatJoinByRequest#f3bb6175 as nil")
	}
	b.PutID(PushMessageContentChatJoinByRequestTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentChatJoinByRequest) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentChatJoinByRequest#f3bb6175 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentChatJoinByRequest) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil")
	}
	if err := b.ConsumeID(PushMessageContentChatJoinByRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentChatJoinByRequest#f3bb6175: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentChatJoinByRequest) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentChatJoinByRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil")
	}

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

// PushMessageContentRecurringPayment represents TL type `pushMessageContentRecurringPayment#6083361a`.
type PushMessageContentRecurringPayment struct {
	// The paid amount
	Amount string
}

// PushMessageContentRecurringPaymentTypeID is TL type id of PushMessageContentRecurringPayment.
const PushMessageContentRecurringPaymentTypeID = 0x6083361a

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentRecurringPayment) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentRecurringPayment{}
)

func (p *PushMessageContentRecurringPayment) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Amount == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentRecurringPayment) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentRecurringPayment",
		ID:   PushMessageContentRecurringPaymentTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Amount",
			SchemaName: "amount",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentRecurringPayment) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil")
	}
	b.PutID(PushMessageContentRecurringPaymentTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentRecurringPayment) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil")
	}
	b.PutString(p.Amount)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentRecurringPayment) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil")
	}
	if err := b.ConsumeID(PushMessageContentRecurringPaymentTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentRecurringPayment) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: field amount: %w", err)
		}
		p.Amount = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentRecurringPayment) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentRecurringPayment")
	b.Comma()
	b.FieldStart("amount")
	b.PutString(p.Amount)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentRecurringPayment) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentRecurringPayment"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: %w", err)
			}
		case "amount":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: field amount: %w", err)
			}
			p.Amount = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetAmount returns value of Amount field.
func (p *PushMessageContentRecurringPayment) GetAmount() (value string) {
	if p == nil {
		return
	}
	return p.Amount
}

// PushMessageContentSuggestProfilePhoto represents TL type `pushMessageContentSuggestProfilePhoto#7d6bf0ab`.
type PushMessageContentSuggestProfilePhoto struct {
}

// PushMessageContentSuggestProfilePhotoTypeID is TL type id of PushMessageContentSuggestProfilePhoto.
const PushMessageContentSuggestProfilePhotoTypeID = 0x7d6bf0ab

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentSuggestProfilePhoto) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentSuggestProfilePhoto{}
)

func (p *PushMessageContentSuggestProfilePhoto) Zero() bool {
	if p == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (p *PushMessageContentSuggestProfilePhoto) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil")
	}
	b.PutID(PushMessageContentSuggestProfilePhotoTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentSuggestProfilePhoto) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentSuggestProfilePhoto) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil")
	}
	if err := b.ConsumeID(PushMessageContentSuggestProfilePhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentSuggestProfilePhoto#7d6bf0ab: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentSuggestProfilePhoto) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentSuggestProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentSuggestProfilePhoto")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentSuggestProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil")
	}

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

// PushMessageContentProximityAlertTriggered represents TL type `pushMessageContentProximityAlertTriggered#f03a8006`.
type PushMessageContentProximityAlertTriggered struct {
	// The distance to the user
	Distance int32
}

// PushMessageContentProximityAlertTriggeredTypeID is TL type id of PushMessageContentProximityAlertTriggered.
const PushMessageContentProximityAlertTriggeredTypeID = 0xf03a8006

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentProximityAlertTriggered) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentProximityAlertTriggered{}
)

func (p *PushMessageContentProximityAlertTriggered) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.Distance == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentProximityAlertTriggered) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentProximityAlertTriggered",
		ID:   PushMessageContentProximityAlertTriggeredTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Distance",
			SchemaName: "distance",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentProximityAlertTriggered) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentProximityAlertTriggered#f03a8006 as nil")
	}
	b.PutID(PushMessageContentProximityAlertTriggeredTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentProximityAlertTriggered) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentProximityAlertTriggered#f03a8006 as nil")
	}
	b.PutInt32(p.Distance)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentProximityAlertTriggered) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentProximityAlertTriggered#f03a8006 to nil")
	}
	if err := b.ConsumeID(PushMessageContentProximityAlertTriggeredTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentProximityAlertTriggered#f03a8006: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentProximityAlertTriggered) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentProximityAlertTriggered#f03a8006 to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentProximityAlertTriggered#f03a8006: field distance: %w", err)
		}
		p.Distance = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentProximityAlertTriggered) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentProximityAlertTriggered#f03a8006 as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentProximityAlertTriggered")
	b.Comma()
	b.FieldStart("distance")
	b.PutInt32(p.Distance)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentProximityAlertTriggered) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentProximityAlertTriggered#f03a8006 to nil")
	}

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

// GetDistance returns value of Distance field.
func (p *PushMessageContentProximityAlertTriggered) GetDistance() (value int32) {
	if p == nil {
		return
	}
	return p.Distance
}

// PushMessageContentMessageForwards represents TL type `pushMessageContentMessageForwards#8df8a81c`.
type PushMessageContentMessageForwards struct {
	// Number of forwarded messages
	TotalCount int32
}

// PushMessageContentMessageForwardsTypeID is TL type id of PushMessageContentMessageForwards.
const PushMessageContentMessageForwardsTypeID = 0x8df8a81c

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentMessageForwards) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentMessageForwards{}
)

func (p *PushMessageContentMessageForwards) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.TotalCount == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentMessageForwards) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentMessageForwards",
		ID:   PushMessageContentMessageForwardsTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TotalCount",
			SchemaName: "total_count",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentMessageForwards) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil")
	}
	b.PutID(PushMessageContentMessageForwardsTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentMessageForwards) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil")
	}
	b.PutInt32(p.TotalCount)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentMessageForwards) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil")
	}
	if err := b.ConsumeID(PushMessageContentMessageForwardsTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentMessageForwards) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: field total_count: %w", err)
		}
		p.TotalCount = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentMessageForwards) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentMessageForwards")
	b.Comma()
	b.FieldStart("total_count")
	b.PutInt32(p.TotalCount)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentMessageForwards) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentMessageForwards"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: %w", err)
			}
		case "total_count":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: field total_count: %w", err)
			}
			p.TotalCount = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTotalCount returns value of TotalCount field.
func (p *PushMessageContentMessageForwards) GetTotalCount() (value int32) {
	if p == nil {
		return
	}
	return p.TotalCount
}

// PushMessageContentMediaAlbum represents TL type `pushMessageContentMediaAlbum#d363e96f`.
type PushMessageContentMediaAlbum struct {
	// Number of messages in the album
	TotalCount int32
	// True, if the album has at least one photo
	HasPhotos bool
	// True, if the album has at least one video file
	HasVideos bool
	// True, if the album has at least one audio file
	HasAudios bool
	// True, if the album has at least one document
	HasDocuments bool
}

// PushMessageContentMediaAlbumTypeID is TL type id of PushMessageContentMediaAlbum.
const PushMessageContentMediaAlbumTypeID = 0xd363e96f

// construct implements constructor of PushMessageContentClass.
func (p PushMessageContentMediaAlbum) construct() PushMessageContentClass { return &p }

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

	_ PushMessageContentClass = &PushMessageContentMediaAlbum{}
)

func (p *PushMessageContentMediaAlbum) Zero() bool {
	if p == nil {
		return true
	}
	if !(p.TotalCount == 0) {
		return false
	}
	if !(p.HasPhotos == false) {
		return false
	}
	if !(p.HasVideos == false) {
		return false
	}
	if !(p.HasAudios == false) {
		return false
	}
	if !(p.HasDocuments == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (p *PushMessageContentMediaAlbum) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "pushMessageContentMediaAlbum",
		ID:   PushMessageContentMediaAlbumTypeID,
	}
	if p == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TotalCount",
			SchemaName: "total_count",
		},
		{
			Name:       "HasPhotos",
			SchemaName: "has_photos",
		},
		{
			Name:       "HasVideos",
			SchemaName: "has_videos",
		},
		{
			Name:       "HasAudios",
			SchemaName: "has_audios",
		},
		{
			Name:       "HasDocuments",
			SchemaName: "has_documents",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (p *PushMessageContentMediaAlbum) Encode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil")
	}
	b.PutID(PushMessageContentMediaAlbumTypeID)
	return p.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (p *PushMessageContentMediaAlbum) EncodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil")
	}
	b.PutInt32(p.TotalCount)
	b.PutBool(p.HasPhotos)
	b.PutBool(p.HasVideos)
	b.PutBool(p.HasAudios)
	b.PutBool(p.HasDocuments)
	return nil
}

// Decode implements bin.Decoder.
func (p *PushMessageContentMediaAlbum) Decode(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil")
	}
	if err := b.ConsumeID(PushMessageContentMediaAlbumTypeID); err != nil {
		return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: %w", err)
	}
	return p.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (p *PushMessageContentMediaAlbum) DecodeBare(b *bin.Buffer) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil")
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field total_count: %w", err)
		}
		p.TotalCount = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_photos: %w", err)
		}
		p.HasPhotos = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_videos: %w", err)
		}
		p.HasVideos = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_audios: %w", err)
		}
		p.HasAudios = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_documents: %w", err)
		}
		p.HasDocuments = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (p *PushMessageContentMediaAlbum) EncodeTDLibJSON(b tdjson.Encoder) error {
	if p == nil {
		return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil")
	}
	b.ObjStart()
	b.PutID("pushMessageContentMediaAlbum")
	b.Comma()
	b.FieldStart("total_count")
	b.PutInt32(p.TotalCount)
	b.Comma()
	b.FieldStart("has_photos")
	b.PutBool(p.HasPhotos)
	b.Comma()
	b.FieldStart("has_videos")
	b.PutBool(p.HasVideos)
	b.Comma()
	b.FieldStart("has_audios")
	b.PutBool(p.HasAudios)
	b.Comma()
	b.FieldStart("has_documents")
	b.PutBool(p.HasDocuments)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (p *PushMessageContentMediaAlbum) DecodeTDLibJSON(b tdjson.Decoder) error {
	if p == nil {
		return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("pushMessageContentMediaAlbum"); err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: %w", err)
			}
		case "total_count":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field total_count: %w", err)
			}
			p.TotalCount = value
		case "has_photos":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_photos: %w", err)
			}
			p.HasPhotos = value
		case "has_videos":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_videos: %w", err)
			}
			p.HasVideos = value
		case "has_audios":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_audios: %w", err)
			}
			p.HasAudios = value
		case "has_documents":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_documents: %w", err)
			}
			p.HasDocuments = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTotalCount returns value of TotalCount field.
func (p *PushMessageContentMediaAlbum) GetTotalCount() (value int32) {
	if p == nil {
		return
	}
	return p.TotalCount
}

// GetHasPhotos returns value of HasPhotos field.
func (p *PushMessageContentMediaAlbum) GetHasPhotos() (value bool) {
	if p == nil {
		return
	}
	return p.HasPhotos
}

// GetHasVideos returns value of HasVideos field.
func (p *PushMessageContentMediaAlbum) GetHasVideos() (value bool) {
	if p == nil {
		return
	}
	return p.HasVideos
}

// GetHasAudios returns value of HasAudios field.
func (p *PushMessageContentMediaAlbum) GetHasAudios() (value bool) {
	if p == nil {
		return
	}
	return p.HasAudios
}

// GetHasDocuments returns value of HasDocuments field.
func (p *PushMessageContentMediaAlbum) GetHasDocuments() (value bool) {
	if p == nil {
		return
	}
	return p.HasDocuments
}

// PushMessageContentClassName is schema name of PushMessageContentClass.
const PushMessageContentClassName = "PushMessageContent"

// PushMessageContentClass represents PushMessageContent generic type.
//
// Example:
//
//	g, err := tdapi.DecodePushMessageContent(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tdapi.PushMessageContentHidden: // pushMessageContentHidden#ed1bb85c
//	case *tdapi.PushMessageContentAnimation: // pushMessageContentAnimation#3da4dfe4
//	case *tdapi.PushMessageContentAudio: // pushMessageContentAudio#16be7872
//	case *tdapi.PushMessageContentContact: // pushMessageContentContact#ff458a54
//	case *tdapi.PushMessageContentContactRegistered: // pushMessageContentContactRegistered#ede1e5a0
//	case *tdapi.PushMessageContentDocument: // pushMessageContentDocument#e4adae01
//	case *tdapi.PushMessageContentGame: // pushMessageContentGame#e14bb91b
//	case *tdapi.PushMessageContentGameScore: // pushMessageContentGameScore#35b8cd88
//	case *tdapi.PushMessageContentInvoice: // pushMessageContentInvoice#98c88bbc
//	case *tdapi.PushMessageContentLocation: // pushMessageContentLocation#b33a97b3
//	case *tdapi.PushMessageContentPaidMedia: // pushMessageContentPaidMedia#b556e74a
//	case *tdapi.PushMessageContentPhoto: // pushMessageContentPhoto#861dc52
//	case *tdapi.PushMessageContentPoll: // pushMessageContentPoll#fd5a743a
//	case *tdapi.PushMessageContentPremiumGiftCode: // pushMessageContentPremiumGiftCode#18a15025
//	case *tdapi.PushMessageContentGiveaway: // pushMessageContentGiveaway#d63e7f8e
//	case *tdapi.PushMessageContentGift: // pushMessageContentGift#84a8cd0b
//	case *tdapi.PushMessageContentUpgradedGift: // pushMessageContentUpgradedGift#99fa0ade
//	case *tdapi.PushMessageContentScreenshotTaken: // pushMessageContentScreenshotTaken#cc51ff9
//	case *tdapi.PushMessageContentSticker: // pushMessageContentSticker#5c98bdd3
//	case *tdapi.PushMessageContentStory: // pushMessageContentStory#23bd824f
//	case *tdapi.PushMessageContentText: // pushMessageContentText#105ddea9
//	case *tdapi.PushMessageContentVideo: // pushMessageContentVideo#127ad12f
//	case *tdapi.PushMessageContentVideoNote: // pushMessageContentVideoNote#bd13f97f
//	case *tdapi.PushMessageContentVoiceNote: // pushMessageContentVoiceNote#54cac8b
//	case *tdapi.PushMessageContentBasicGroupChatCreate: // pushMessageContentBasicGroupChatCreate#81f1defc
//	case *tdapi.PushMessageContentVideoChatStarted: // pushMessageContentVideoChatStarted#de3b2c3f
//	case *tdapi.PushMessageContentVideoChatEnded: // pushMessageContentVideoChatEnded#b57a74e3
//	case *tdapi.PushMessageContentInviteVideoChatParticipants: // pushMessageContentInviteVideoChatParticipants#1eda428d
//	case *tdapi.PushMessageContentChatAddMembers: // pushMessageContentChatAddMembers#bf337b3a
//	case *tdapi.PushMessageContentChatChangePhoto: // pushMessageContentChatChangePhoto#bd96521d
//	case *tdapi.PushMessageContentChatChangeTitle: // pushMessageContentChatChangeTitle#8ae1f6a3
//	case *tdapi.PushMessageContentChatSetBackground: // pushMessageContentChatSetBackground#a72b56e3
//	case *tdapi.PushMessageContentChatSetTheme: // pushMessageContentChatSetTheme#a5d3b68
//	case *tdapi.PushMessageContentChatDeleteMember: // pushMessageContentChatDeleteMember#23afa99f
//	case *tdapi.PushMessageContentChatJoinByLink: // pushMessageContentChatJoinByLink#5c9bdf49
//	case *tdapi.PushMessageContentChatJoinByRequest: // pushMessageContentChatJoinByRequest#f3bb6175
//	case *tdapi.PushMessageContentRecurringPayment: // pushMessageContentRecurringPayment#6083361a
//	case *tdapi.PushMessageContentSuggestProfilePhoto: // pushMessageContentSuggestProfilePhoto#7d6bf0ab
//	case *tdapi.PushMessageContentProximityAlertTriggered: // pushMessageContentProximityAlertTriggered#f03a8006
//	case *tdapi.PushMessageContentMessageForwards: // pushMessageContentMessageForwards#8df8a81c
//	case *tdapi.PushMessageContentMediaAlbum: // pushMessageContentMediaAlbum#d363e96f
//	default: panic(v)
//	}
type PushMessageContentClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() PushMessageContentClass

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

// DecodePushMessageContent implements binary de-serialization for PushMessageContentClass.
func DecodePushMessageContent(buf *bin.Buffer) (PushMessageContentClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case PushMessageContentHiddenTypeID:
		// Decoding pushMessageContentHidden#ed1bb85c.
		v := PushMessageContentHidden{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentAnimationTypeID:
		// Decoding pushMessageContentAnimation#3da4dfe4.
		v := PushMessageContentAnimation{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentAudioTypeID:
		// Decoding pushMessageContentAudio#16be7872.
		v := PushMessageContentAudio{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentContactTypeID:
		// Decoding pushMessageContentContact#ff458a54.
		v := PushMessageContentContact{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentContactRegisteredTypeID:
		// Decoding pushMessageContentContactRegistered#ede1e5a0.
		v := PushMessageContentContactRegistered{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentDocumentTypeID:
		// Decoding pushMessageContentDocument#e4adae01.
		v := PushMessageContentDocument{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentGameTypeID:
		// Decoding pushMessageContentGame#e14bb91b.
		v := PushMessageContentGame{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentGameScoreTypeID:
		// Decoding pushMessageContentGameScore#35b8cd88.
		v := PushMessageContentGameScore{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentInvoiceTypeID:
		// Decoding pushMessageContentInvoice#98c88bbc.
		v := PushMessageContentInvoice{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentLocationTypeID:
		// Decoding pushMessageContentLocation#b33a97b3.
		v := PushMessageContentLocation{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentPaidMediaTypeID:
		// Decoding pushMessageContentPaidMedia#b556e74a.
		v := PushMessageContentPaidMedia{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentPhotoTypeID:
		// Decoding pushMessageContentPhoto#861dc52.
		v := PushMessageContentPhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentPollTypeID:
		// Decoding pushMessageContentPoll#fd5a743a.
		v := PushMessageContentPoll{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentPremiumGiftCodeTypeID:
		// Decoding pushMessageContentPremiumGiftCode#18a15025.
		v := PushMessageContentPremiumGiftCode{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentGiveawayTypeID:
		// Decoding pushMessageContentGiveaway#d63e7f8e.
		v := PushMessageContentGiveaway{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentGiftTypeID:
		// Decoding pushMessageContentGift#84a8cd0b.
		v := PushMessageContentGift{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentUpgradedGiftTypeID:
		// Decoding pushMessageContentUpgradedGift#99fa0ade.
		v := PushMessageContentUpgradedGift{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentScreenshotTakenTypeID:
		// Decoding pushMessageContentScreenshotTaken#cc51ff9.
		v := PushMessageContentScreenshotTaken{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentStickerTypeID:
		// Decoding pushMessageContentSticker#5c98bdd3.
		v := PushMessageContentSticker{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentStoryTypeID:
		// Decoding pushMessageContentStory#23bd824f.
		v := PushMessageContentStory{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentTextTypeID:
		// Decoding pushMessageContentText#105ddea9.
		v := PushMessageContentText{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentVideoTypeID:
		// Decoding pushMessageContentVideo#127ad12f.
		v := PushMessageContentVideo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentVideoNoteTypeID:
		// Decoding pushMessageContentVideoNote#bd13f97f.
		v := PushMessageContentVideoNote{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentVoiceNoteTypeID:
		// Decoding pushMessageContentVoiceNote#54cac8b.
		v := PushMessageContentVoiceNote{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentBasicGroupChatCreateTypeID:
		// Decoding pushMessageContentBasicGroupChatCreate#81f1defc.
		v := PushMessageContentBasicGroupChatCreate{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentVideoChatStartedTypeID:
		// Decoding pushMessageContentVideoChatStarted#de3b2c3f.
		v := PushMessageContentVideoChatStarted{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentVideoChatEndedTypeID:
		// Decoding pushMessageContentVideoChatEnded#b57a74e3.
		v := PushMessageContentVideoChatEnded{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentInviteVideoChatParticipantsTypeID:
		// Decoding pushMessageContentInviteVideoChatParticipants#1eda428d.
		v := PushMessageContentInviteVideoChatParticipants{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatAddMembersTypeID:
		// Decoding pushMessageContentChatAddMembers#bf337b3a.
		v := PushMessageContentChatAddMembers{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatChangePhotoTypeID:
		// Decoding pushMessageContentChatChangePhoto#bd96521d.
		v := PushMessageContentChatChangePhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatChangeTitleTypeID:
		// Decoding pushMessageContentChatChangeTitle#8ae1f6a3.
		v := PushMessageContentChatChangeTitle{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatSetBackgroundTypeID:
		// Decoding pushMessageContentChatSetBackground#a72b56e3.
		v := PushMessageContentChatSetBackground{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatSetThemeTypeID:
		// Decoding pushMessageContentChatSetTheme#a5d3b68.
		v := PushMessageContentChatSetTheme{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatDeleteMemberTypeID:
		// Decoding pushMessageContentChatDeleteMember#23afa99f.
		v := PushMessageContentChatDeleteMember{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatJoinByLinkTypeID:
		// Decoding pushMessageContentChatJoinByLink#5c9bdf49.
		v := PushMessageContentChatJoinByLink{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentChatJoinByRequestTypeID:
		// Decoding pushMessageContentChatJoinByRequest#f3bb6175.
		v := PushMessageContentChatJoinByRequest{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentRecurringPaymentTypeID:
		// Decoding pushMessageContentRecurringPayment#6083361a.
		v := PushMessageContentRecurringPayment{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentSuggestProfilePhotoTypeID:
		// Decoding pushMessageContentSuggestProfilePhoto#7d6bf0ab.
		v := PushMessageContentSuggestProfilePhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentProximityAlertTriggeredTypeID:
		// Decoding pushMessageContentProximityAlertTriggered#f03a8006.
		v := PushMessageContentProximityAlertTriggered{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentMessageForwardsTypeID:
		// Decoding pushMessageContentMessageForwards#8df8a81c.
		v := PushMessageContentMessageForwards{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case PushMessageContentMediaAlbumTypeID:
		// Decoding pushMessageContentMediaAlbum#d363e96f.
		v := PushMessageContentMediaAlbum{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecodeTDLibJSONPushMessageContent implements binary de-serialization for PushMessageContentClass.
func DecodeTDLibJSONPushMessageContent(buf tdjson.Decoder) (PushMessageContentClass, error) {
	id, err := buf.FindTypeID()
	if err != nil {
		return nil, err
	}
	switch id {
	case "pushMessageContentHidden":
		// Decoding pushMessageContentHidden#ed1bb85c.
		v := PushMessageContentHidden{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentAnimation":
		// Decoding pushMessageContentAnimation#3da4dfe4.
		v := PushMessageContentAnimation{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentAudio":
		// Decoding pushMessageContentAudio#16be7872.
		v := PushMessageContentAudio{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentContact":
		// Decoding pushMessageContentContact#ff458a54.
		v := PushMessageContentContact{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentContactRegistered":
		// Decoding pushMessageContentContactRegistered#ede1e5a0.
		v := PushMessageContentContactRegistered{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentDocument":
		// Decoding pushMessageContentDocument#e4adae01.
		v := PushMessageContentDocument{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentGame":
		// Decoding pushMessageContentGame#e14bb91b.
		v := PushMessageContentGame{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentGameScore":
		// Decoding pushMessageContentGameScore#35b8cd88.
		v := PushMessageContentGameScore{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentInvoice":
		// Decoding pushMessageContentInvoice#98c88bbc.
		v := PushMessageContentInvoice{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentLocation":
		// Decoding pushMessageContentLocation#b33a97b3.
		v := PushMessageContentLocation{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentPaidMedia":
		// Decoding pushMessageContentPaidMedia#b556e74a.
		v := PushMessageContentPaidMedia{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentPhoto":
		// Decoding pushMessageContentPhoto#861dc52.
		v := PushMessageContentPhoto{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentPoll":
		// Decoding pushMessageContentPoll#fd5a743a.
		v := PushMessageContentPoll{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentPremiumGiftCode":
		// Decoding pushMessageContentPremiumGiftCode#18a15025.
		v := PushMessageContentPremiumGiftCode{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentGiveaway":
		// Decoding pushMessageContentGiveaway#d63e7f8e.
		v := PushMessageContentGiveaway{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentGift":
		// Decoding pushMessageContentGift#84a8cd0b.
		v := PushMessageContentGift{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentUpgradedGift":
		// Decoding pushMessageContentUpgradedGift#99fa0ade.
		v := PushMessageContentUpgradedGift{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentScreenshotTaken":
		// Decoding pushMessageContentScreenshotTaken#cc51ff9.
		v := PushMessageContentScreenshotTaken{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentSticker":
		// Decoding pushMessageContentSticker#5c98bdd3.
		v := PushMessageContentSticker{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentStory":
		// Decoding pushMessageContentStory#23bd824f.
		v := PushMessageContentStory{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentText":
		// Decoding pushMessageContentText#105ddea9.
		v := PushMessageContentText{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentVideo":
		// Decoding pushMessageContentVideo#127ad12f.
		v := PushMessageContentVideo{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentVideoNote":
		// Decoding pushMessageContentVideoNote#bd13f97f.
		v := PushMessageContentVideoNote{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentVoiceNote":
		// Decoding pushMessageContentVoiceNote#54cac8b.
		v := PushMessageContentVoiceNote{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentBasicGroupChatCreate":
		// Decoding pushMessageContentBasicGroupChatCreate#81f1defc.
		v := PushMessageContentBasicGroupChatCreate{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentVideoChatStarted":
		// Decoding pushMessageContentVideoChatStarted#de3b2c3f.
		v := PushMessageContentVideoChatStarted{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentVideoChatEnded":
		// Decoding pushMessageContentVideoChatEnded#b57a74e3.
		v := PushMessageContentVideoChatEnded{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentInviteVideoChatParticipants":
		// Decoding pushMessageContentInviteVideoChatParticipants#1eda428d.
		v := PushMessageContentInviteVideoChatParticipants{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatAddMembers":
		// Decoding pushMessageContentChatAddMembers#bf337b3a.
		v := PushMessageContentChatAddMembers{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatChangePhoto":
		// Decoding pushMessageContentChatChangePhoto#bd96521d.
		v := PushMessageContentChatChangePhoto{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatChangeTitle":
		// Decoding pushMessageContentChatChangeTitle#8ae1f6a3.
		v := PushMessageContentChatChangeTitle{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatSetBackground":
		// Decoding pushMessageContentChatSetBackground#a72b56e3.
		v := PushMessageContentChatSetBackground{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatSetTheme":
		// Decoding pushMessageContentChatSetTheme#a5d3b68.
		v := PushMessageContentChatSetTheme{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatDeleteMember":
		// Decoding pushMessageContentChatDeleteMember#23afa99f.
		v := PushMessageContentChatDeleteMember{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatJoinByLink":
		// Decoding pushMessageContentChatJoinByLink#5c9bdf49.
		v := PushMessageContentChatJoinByLink{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentChatJoinByRequest":
		// Decoding pushMessageContentChatJoinByRequest#f3bb6175.
		v := PushMessageContentChatJoinByRequest{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentRecurringPayment":
		// Decoding pushMessageContentRecurringPayment#6083361a.
		v := PushMessageContentRecurringPayment{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentSuggestProfilePhoto":
		// Decoding pushMessageContentSuggestProfilePhoto#7d6bf0ab.
		v := PushMessageContentSuggestProfilePhoto{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentProximityAlertTriggered":
		// Decoding pushMessageContentProximityAlertTriggered#f03a8006.
		v := PushMessageContentProximityAlertTriggered{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentMessageForwards":
		// Decoding pushMessageContentMessageForwards#8df8a81c.
		v := PushMessageContentMessageForwards{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	case "pushMessageContentMediaAlbum":
		// Decoding pushMessageContentMediaAlbum#d363e96f.
		v := PushMessageContentMediaAlbum{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", tdjson.NewUnexpectedID(id))
	}
}

// PushMessageContent boxes the PushMessageContentClass providing a helper.
type PushMessageContentBox struct {
	PushMessageContent PushMessageContentClass
}

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

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

// DecodeTDLibJSON implements bin.Decoder for PushMessageContentBox.
func (b *PushMessageContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
	if b == nil {
		return fmt.Errorf("unable to decode PushMessageContentBox to nil")
	}
	v, err := DecodeTDLibJSONPushMessageContent(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.PushMessageContent = v
	return nil
}

// EncodeTDLibJSON implements bin.Encode for PushMessageContentBox.
func (b *PushMessageContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
	if b == nil || b.PushMessageContent == nil {
		return fmt.Errorf("unable to encode PushMessageContentClass as nil")
	}
	return b.PushMessageContent.EncodeTDLibJSON(buf)
}
