// Code generated by gotdgen, DO NOT EDIT.

package e2e

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

// DecryptedMessageMediaEmpty represents TL type `decryptedMessageMediaEmpty#89f5c4a`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaEmpty for reference.
type DecryptedMessageMediaEmpty struct {
}

// DecryptedMessageMediaEmptyTypeID is TL type id of DecryptedMessageMediaEmpty.
const DecryptedMessageMediaEmptyTypeID = 0x89f5c4a

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaEmpty) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaEmpty{}
)

func (d *DecryptedMessageMediaEmpty) Zero() bool {
	if d == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaEmpty) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaEmpty#89f5c4a as nil")
	}
	b.PutID(DecryptedMessageMediaEmptyTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaEmpty) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaEmpty#89f5c4a as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaEmpty) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaEmpty#89f5c4a to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaEmptyTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaEmpty#89f5c4a: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaEmpty) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaEmpty#89f5c4a to nil")
	}
	return nil
}

// DecryptedMessageMediaPhoto8 represents TL type `decryptedMessageMediaPhoto8#32798a8c`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaPhoto8 for reference.
type DecryptedMessageMediaPhoto8 struct {
	// Thumb field of DecryptedMessageMediaPhoto8.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaPhoto8.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaPhoto8.
	ThumbH int
	// W field of DecryptedMessageMediaPhoto8.
	W int
	// H field of DecryptedMessageMediaPhoto8.
	H int
	// Size field of DecryptedMessageMediaPhoto8.
	Size int
	// Key field of DecryptedMessageMediaPhoto8.
	Key []byte
	// Iv field of DecryptedMessageMediaPhoto8.
	Iv []byte
}

// DecryptedMessageMediaPhoto8TypeID is TL type id of DecryptedMessageMediaPhoto8.
const DecryptedMessageMediaPhoto8TypeID = 0x32798a8c

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaPhoto8) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaPhoto8{}
)

func (d *DecryptedMessageMediaPhoto8) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.W == 0) {
		return false
	}
	if !(d.H == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaPhoto8) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaPhoto8",
		ID:   DecryptedMessageMediaPhoto8TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaPhoto8) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaPhoto8#32798a8c as nil")
	}
	b.PutID(DecryptedMessageMediaPhoto8TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaPhoto8) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaPhoto8#32798a8c as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutInt(d.W)
	b.PutInt(d.H)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaPhoto8) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaPhoto8#32798a8c to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaPhoto8TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaPhoto8) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaPhoto8#32798a8c to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field w: %w", err)
		}
		d.W = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field h: %w", err)
		}
		d.H = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto8#32798a8c: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaPhoto8) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaPhoto8) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaPhoto8) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetW returns value of W field.
func (d *DecryptedMessageMediaPhoto8) GetW() (value int) {
	if d == nil {
		return
	}
	return d.W
}

// GetH returns value of H field.
func (d *DecryptedMessageMediaPhoto8) GetH() (value int) {
	if d == nil {
		return
	}
	return d.H
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaPhoto8) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaPhoto8) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaPhoto8) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaVideo8 represents TL type `decryptedMessageMediaVideo8#4cee6ef3`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaVideo8 for reference.
type DecryptedMessageMediaVideo8 struct {
	// Thumb field of DecryptedMessageMediaVideo8.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaVideo8.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaVideo8.
	ThumbH int
	// Duration field of DecryptedMessageMediaVideo8.
	Duration int
	// W field of DecryptedMessageMediaVideo8.
	W int
	// H field of DecryptedMessageMediaVideo8.
	H int
	// Size field of DecryptedMessageMediaVideo8.
	Size int
	// Key field of DecryptedMessageMediaVideo8.
	Key []byte
	// Iv field of DecryptedMessageMediaVideo8.
	Iv []byte
}

// DecryptedMessageMediaVideo8TypeID is TL type id of DecryptedMessageMediaVideo8.
const DecryptedMessageMediaVideo8TypeID = 0x4cee6ef3

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaVideo8) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaVideo8{}
)

func (d *DecryptedMessageMediaVideo8) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.Duration == 0) {
		return false
	}
	if !(d.W == 0) {
		return false
	}
	if !(d.H == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaVideo8) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaVideo8",
		ID:   DecryptedMessageMediaVideo8TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "Duration",
			SchemaName: "duration",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaVideo8) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo8#4cee6ef3 as nil")
	}
	b.PutID(DecryptedMessageMediaVideo8TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaVideo8) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo8#4cee6ef3 as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutInt(d.Duration)
	b.PutInt(d.W)
	b.PutInt(d.H)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaVideo8) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo8#4cee6ef3 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaVideo8TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaVideo8) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo8#4cee6ef3 to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field duration: %w", err)
		}
		d.Duration = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field w: %w", err)
		}
		d.W = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field h: %w", err)
		}
		d.H = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo8#4cee6ef3: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaVideo8) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaVideo8) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaVideo8) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetDuration returns value of Duration field.
func (d *DecryptedMessageMediaVideo8) GetDuration() (value int) {
	if d == nil {
		return
	}
	return d.Duration
}

// GetW returns value of W field.
func (d *DecryptedMessageMediaVideo8) GetW() (value int) {
	if d == nil {
		return
	}
	return d.W
}

// GetH returns value of H field.
func (d *DecryptedMessageMediaVideo8) GetH() (value int) {
	if d == nil {
		return
	}
	return d.H
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaVideo8) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaVideo8) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaVideo8) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaGeoPoint represents TL type `decryptedMessageMediaGeoPoint#35480a59`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaGeoPoint for reference.
type DecryptedMessageMediaGeoPoint struct {
	// Lat field of DecryptedMessageMediaGeoPoint.
	Lat float64
	// Long field of DecryptedMessageMediaGeoPoint.
	Long float64
}

// DecryptedMessageMediaGeoPointTypeID is TL type id of DecryptedMessageMediaGeoPoint.
const DecryptedMessageMediaGeoPointTypeID = 0x35480a59

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaGeoPoint) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaGeoPoint{}
)

func (d *DecryptedMessageMediaGeoPoint) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Lat == 0) {
		return false
	}
	if !(d.Long == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaGeoPoint) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaGeoPoint",
		ID:   DecryptedMessageMediaGeoPointTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Lat",
			SchemaName: "lat",
		},
		{
			Name:       "Long",
			SchemaName: "long",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaGeoPoint) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaGeoPoint#35480a59 as nil")
	}
	b.PutID(DecryptedMessageMediaGeoPointTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaGeoPoint) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaGeoPoint#35480a59 as nil")
	}
	b.PutDouble(d.Lat)
	b.PutDouble(d.Long)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaGeoPoint) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaGeoPoint#35480a59 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaGeoPointTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaGeoPoint#35480a59: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaGeoPoint) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaGeoPoint#35480a59 to nil")
	}
	{
		value, err := b.Double()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaGeoPoint#35480a59: field lat: %w", err)
		}
		d.Lat = value
	}
	{
		value, err := b.Double()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaGeoPoint#35480a59: field long: %w", err)
		}
		d.Long = value
	}
	return nil
}

// GetLat returns value of Lat field.
func (d *DecryptedMessageMediaGeoPoint) GetLat() (value float64) {
	if d == nil {
		return
	}
	return d.Lat
}

// GetLong returns value of Long field.
func (d *DecryptedMessageMediaGeoPoint) GetLong() (value float64) {
	if d == nil {
		return
	}
	return d.Long
}

// DecryptedMessageMediaContact represents TL type `decryptedMessageMediaContact#588a0a97`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaContact for reference.
type DecryptedMessageMediaContact struct {
	// PhoneNumber field of DecryptedMessageMediaContact.
	PhoneNumber string
	// FirstName field of DecryptedMessageMediaContact.
	FirstName string
	// LastName field of DecryptedMessageMediaContact.
	LastName string
	// UserID field of DecryptedMessageMediaContact.
	UserID int
}

// DecryptedMessageMediaContactTypeID is TL type id of DecryptedMessageMediaContact.
const DecryptedMessageMediaContactTypeID = 0x588a0a97

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaContact) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaContact{}
)

func (d *DecryptedMessageMediaContact) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.PhoneNumber == "") {
		return false
	}
	if !(d.FirstName == "") {
		return false
	}
	if !(d.LastName == "") {
		return false
	}
	if !(d.UserID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaContact) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaContact",
		ID:   DecryptedMessageMediaContactTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "FirstName",
			SchemaName: "first_name",
		},
		{
			Name:       "LastName",
			SchemaName: "last_name",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaContact) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaContact#588a0a97 as nil")
	}
	b.PutID(DecryptedMessageMediaContactTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaContact) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaContact#588a0a97 as nil")
	}
	b.PutString(d.PhoneNumber)
	b.PutString(d.FirstName)
	b.PutString(d.LastName)
	b.PutInt(d.UserID)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaContact) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaContact#588a0a97 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaContactTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaContact#588a0a97: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaContact) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaContact#588a0a97 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaContact#588a0a97: field phone_number: %w", err)
		}
		d.PhoneNumber = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaContact#588a0a97: field first_name: %w", err)
		}
		d.FirstName = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaContact#588a0a97: field last_name: %w", err)
		}
		d.LastName = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaContact#588a0a97: field user_id: %w", err)
		}
		d.UserID = value
	}
	return nil
}

// GetPhoneNumber returns value of PhoneNumber field.
func (d *DecryptedMessageMediaContact) GetPhoneNumber() (value string) {
	if d == nil {
		return
	}
	return d.PhoneNumber
}

// GetFirstName returns value of FirstName field.
func (d *DecryptedMessageMediaContact) GetFirstName() (value string) {
	if d == nil {
		return
	}
	return d.FirstName
}

// GetLastName returns value of LastName field.
func (d *DecryptedMessageMediaContact) GetLastName() (value string) {
	if d == nil {
		return
	}
	return d.LastName
}

// GetUserID returns value of UserID field.
func (d *DecryptedMessageMediaContact) GetUserID() (value int) {
	if d == nil {
		return
	}
	return d.UserID
}

// DecryptedMessageMediaDocument8 represents TL type `decryptedMessageMediaDocument8#b095434b`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaDocument8 for reference.
type DecryptedMessageMediaDocument8 struct {
	// Thumb field of DecryptedMessageMediaDocument8.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaDocument8.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaDocument8.
	ThumbH int
	// FileName field of DecryptedMessageMediaDocument8.
	FileName string
	// MimeType field of DecryptedMessageMediaDocument8.
	MimeType string
	// Size field of DecryptedMessageMediaDocument8.
	Size int
	// Key field of DecryptedMessageMediaDocument8.
	Key []byte
	// Iv field of DecryptedMessageMediaDocument8.
	Iv []byte
}

// DecryptedMessageMediaDocument8TypeID is TL type id of DecryptedMessageMediaDocument8.
const DecryptedMessageMediaDocument8TypeID = 0xb095434b

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaDocument8) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaDocument8{}
)

func (d *DecryptedMessageMediaDocument8) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.FileName == "") {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaDocument8) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaDocument8",
		ID:   DecryptedMessageMediaDocument8TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "FileName",
			SchemaName: "file_name",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaDocument8) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument8#b095434b as nil")
	}
	b.PutID(DecryptedMessageMediaDocument8TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaDocument8) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument8#b095434b as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutString(d.FileName)
	b.PutString(d.MimeType)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaDocument8) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument8#b095434b to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaDocument8TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaDocument8) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument8#b095434b to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field file_name: %w", err)
		}
		d.FileName = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument8#b095434b: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaDocument8) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaDocument8) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaDocument8) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetFileName returns value of FileName field.
func (d *DecryptedMessageMediaDocument8) GetFileName() (value string) {
	if d == nil {
		return
	}
	return d.FileName
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaDocument8) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaDocument8) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaDocument8) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaDocument8) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaAudio8 represents TL type `decryptedMessageMediaAudio8#6080758f`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaAudio8 for reference.
type DecryptedMessageMediaAudio8 struct {
	// Duration field of DecryptedMessageMediaAudio8.
	Duration int
	// Size field of DecryptedMessageMediaAudio8.
	Size int
	// Key field of DecryptedMessageMediaAudio8.
	Key []byte
	// Iv field of DecryptedMessageMediaAudio8.
	Iv []byte
}

// DecryptedMessageMediaAudio8TypeID is TL type id of DecryptedMessageMediaAudio8.
const DecryptedMessageMediaAudio8TypeID = 0x6080758f

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaAudio8) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaAudio8{}
)

func (d *DecryptedMessageMediaAudio8) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Duration == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaAudio8) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaAudio8",
		ID:   DecryptedMessageMediaAudio8TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Duration",
			SchemaName: "duration",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaAudio8) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaAudio8#6080758f as nil")
	}
	b.PutID(DecryptedMessageMediaAudio8TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaAudio8) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaAudio8#6080758f as nil")
	}
	b.PutInt(d.Duration)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaAudio8) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaAudio8#6080758f to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaAudio8TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaAudio8#6080758f: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaAudio8) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaAudio8#6080758f to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio8#6080758f: field duration: %w", err)
		}
		d.Duration = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio8#6080758f: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio8#6080758f: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio8#6080758f: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetDuration returns value of Duration field.
func (d *DecryptedMessageMediaAudio8) GetDuration() (value int) {
	if d == nil {
		return
	}
	return d.Duration
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaAudio8) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaAudio8) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaAudio8) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaVideo23 represents TL type `decryptedMessageMediaVideo23#524a415d`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaVideo23 for reference.
type DecryptedMessageMediaVideo23 struct {
	// Thumb field of DecryptedMessageMediaVideo23.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaVideo23.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaVideo23.
	ThumbH int
	// Duration field of DecryptedMessageMediaVideo23.
	Duration int
	// MimeType field of DecryptedMessageMediaVideo23.
	MimeType string
	// W field of DecryptedMessageMediaVideo23.
	W int
	// H field of DecryptedMessageMediaVideo23.
	H int
	// Size field of DecryptedMessageMediaVideo23.
	Size int
	// Key field of DecryptedMessageMediaVideo23.
	Key []byte
	// Iv field of DecryptedMessageMediaVideo23.
	Iv []byte
}

// DecryptedMessageMediaVideo23TypeID is TL type id of DecryptedMessageMediaVideo23.
const DecryptedMessageMediaVideo23TypeID = 0x524a415d

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaVideo23) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaVideo23{}
)

func (d *DecryptedMessageMediaVideo23) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.Duration == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.W == 0) {
		return false
	}
	if !(d.H == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaVideo23) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaVideo23",
		ID:   DecryptedMessageMediaVideo23TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "Duration",
			SchemaName: "duration",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaVideo23) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo23#524a415d as nil")
	}
	b.PutID(DecryptedMessageMediaVideo23TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaVideo23) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo23#524a415d as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutInt(d.Duration)
	b.PutString(d.MimeType)
	b.PutInt(d.W)
	b.PutInt(d.H)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaVideo23) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo23#524a415d to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaVideo23TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaVideo23) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo23#524a415d to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field duration: %w", err)
		}
		d.Duration = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field w: %w", err)
		}
		d.W = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field h: %w", err)
		}
		d.H = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo23#524a415d: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaVideo23) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaVideo23) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaVideo23) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetDuration returns value of Duration field.
func (d *DecryptedMessageMediaVideo23) GetDuration() (value int) {
	if d == nil {
		return
	}
	return d.Duration
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaVideo23) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetW returns value of W field.
func (d *DecryptedMessageMediaVideo23) GetW() (value int) {
	if d == nil {
		return
	}
	return d.W
}

// GetH returns value of H field.
func (d *DecryptedMessageMediaVideo23) GetH() (value int) {
	if d == nil {
		return
	}
	return d.H
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaVideo23) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaVideo23) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaVideo23) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaAudio represents TL type `decryptedMessageMediaAudio#57e0a9cb`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaAudio for reference.
type DecryptedMessageMediaAudio struct {
	// Duration field of DecryptedMessageMediaAudio.
	Duration int
	// MimeType field of DecryptedMessageMediaAudio.
	MimeType string
	// Size field of DecryptedMessageMediaAudio.
	Size int
	// Key field of DecryptedMessageMediaAudio.
	Key []byte
	// Iv field of DecryptedMessageMediaAudio.
	Iv []byte
}

// DecryptedMessageMediaAudioTypeID is TL type id of DecryptedMessageMediaAudio.
const DecryptedMessageMediaAudioTypeID = 0x57e0a9cb

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaAudio) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaAudio{}
)

func (d *DecryptedMessageMediaAudio) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Duration == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaAudio) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaAudio",
		ID:   DecryptedMessageMediaAudioTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Duration",
			SchemaName: "duration",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaAudio) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaAudio#57e0a9cb as nil")
	}
	b.PutID(DecryptedMessageMediaAudioTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaAudio) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaAudio#57e0a9cb as nil")
	}
	b.PutInt(d.Duration)
	b.PutString(d.MimeType)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaAudio) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaAudio#57e0a9cb to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaAudioTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaAudio) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaAudio#57e0a9cb to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: field duration: %w", err)
		}
		d.Duration = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaAudio#57e0a9cb: field iv: %w", err)
		}
		d.Iv = value
	}
	return nil
}

// GetDuration returns value of Duration field.
func (d *DecryptedMessageMediaAudio) GetDuration() (value int) {
	if d == nil {
		return
	}
	return d.Duration
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaAudio) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaAudio) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaAudio) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaAudio) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// DecryptedMessageMediaExternalDocument represents TL type `decryptedMessageMediaExternalDocument#fa95b0dd`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaExternalDocument for reference.
type DecryptedMessageMediaExternalDocument struct {
	// ID field of DecryptedMessageMediaExternalDocument.
	ID int64
	// AccessHash field of DecryptedMessageMediaExternalDocument.
	AccessHash int64
	// Date field of DecryptedMessageMediaExternalDocument.
	Date int
	// MimeType field of DecryptedMessageMediaExternalDocument.
	MimeType string
	// Size field of DecryptedMessageMediaExternalDocument.
	Size int
	// Thumb field of DecryptedMessageMediaExternalDocument.
	Thumb PhotoSizeClass
	// DCID field of DecryptedMessageMediaExternalDocument.
	DCID int
	// Attributes field of DecryptedMessageMediaExternalDocument.
	Attributes []DocumentAttributeClass
}

// DecryptedMessageMediaExternalDocumentTypeID is TL type id of DecryptedMessageMediaExternalDocument.
const DecryptedMessageMediaExternalDocumentTypeID = 0xfa95b0dd

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaExternalDocument) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaExternalDocument{}
)

func (d *DecryptedMessageMediaExternalDocument) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.ID == 0) {
		return false
	}
	if !(d.AccessHash == 0) {
		return false
	}
	if !(d.Date == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.DCID == 0) {
		return false
	}
	if !(d.Attributes == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaExternalDocument) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaExternalDocument",
		ID:   DecryptedMessageMediaExternalDocumentTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "DCID",
			SchemaName: "dc_id",
		},
		{
			Name:       "Attributes",
			SchemaName: "attributes",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaExternalDocument) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaExternalDocument#fa95b0dd as nil")
	}
	b.PutID(DecryptedMessageMediaExternalDocumentTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaExternalDocument) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaExternalDocument#fa95b0dd as nil")
	}
	b.PutLong(d.ID)
	b.PutLong(d.AccessHash)
	b.PutInt(d.Date)
	b.PutString(d.MimeType)
	b.PutInt(d.Size)
	if d.Thumb == nil {
		return fmt.Errorf("unable to encode decryptedMessageMediaExternalDocument#fa95b0dd: field thumb is nil")
	}
	if err := d.Thumb.Encode(b); err != nil {
		return fmt.Errorf("unable to encode decryptedMessageMediaExternalDocument#fa95b0dd: field thumb: %w", err)
	}
	b.PutInt(d.DCID)
	b.PutVectorHeader(len(d.Attributes))
	for idx, v := range d.Attributes {
		if v == nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaExternalDocument#fa95b0dd: field attributes element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaExternalDocument#fa95b0dd: field attributes element with index %d: %w", idx, err)
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaExternalDocument) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaExternalDocument#fa95b0dd to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaExternalDocumentTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaExternalDocument) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaExternalDocument#fa95b0dd to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field id: %w", err)
		}
		d.ID = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field access_hash: %w", err)
		}
		d.AccessHash = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field date: %w", err)
		}
		d.Date = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := DecodePhotoSize(b)
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field dc_id: %w", err)
		}
		d.DCID = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field attributes: %w", err)
		}

		if headerLen > 0 {
			d.Attributes = make([]DocumentAttributeClass, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := DecodeDocumentAttribute(b)
			if err != nil {
				return fmt.Errorf("unable to decode decryptedMessageMediaExternalDocument#fa95b0dd: field attributes: %w", err)
			}
			d.Attributes = append(d.Attributes, value)
		}
	}
	return nil
}

// GetID returns value of ID field.
func (d *DecryptedMessageMediaExternalDocument) GetID() (value int64) {
	if d == nil {
		return
	}
	return d.ID
}

// GetAccessHash returns value of AccessHash field.
func (d *DecryptedMessageMediaExternalDocument) GetAccessHash() (value int64) {
	if d == nil {
		return
	}
	return d.AccessHash
}

// GetDate returns value of Date field.
func (d *DecryptedMessageMediaExternalDocument) GetDate() (value int) {
	if d == nil {
		return
	}
	return d.Date
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaExternalDocument) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaExternalDocument) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaExternalDocument) GetThumb() (value PhotoSizeClass) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetDCID returns value of DCID field.
func (d *DecryptedMessageMediaExternalDocument) GetDCID() (value int) {
	if d == nil {
		return
	}
	return d.DCID
}

// GetAttributes returns value of Attributes field.
func (d *DecryptedMessageMediaExternalDocument) GetAttributes() (value []DocumentAttributeClass) {
	if d == nil {
		return
	}
	return d.Attributes
}

// DecryptedMessageMediaPhoto represents TL type `decryptedMessageMediaPhoto#f1fa8d78`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaPhoto for reference.
type DecryptedMessageMediaPhoto struct {
	// Thumb field of DecryptedMessageMediaPhoto.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaPhoto.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaPhoto.
	ThumbH int
	// W field of DecryptedMessageMediaPhoto.
	W int
	// H field of DecryptedMessageMediaPhoto.
	H int
	// Size field of DecryptedMessageMediaPhoto.
	Size int
	// Key field of DecryptedMessageMediaPhoto.
	Key []byte
	// Iv field of DecryptedMessageMediaPhoto.
	Iv []byte
	// Caption field of DecryptedMessageMediaPhoto.
	Caption string
}

// DecryptedMessageMediaPhotoTypeID is TL type id of DecryptedMessageMediaPhoto.
const DecryptedMessageMediaPhotoTypeID = 0xf1fa8d78

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaPhoto) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaPhoto{}
)

func (d *DecryptedMessageMediaPhoto) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.W == 0) {
		return false
	}
	if !(d.H == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}
	if !(d.Caption == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaPhoto) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaPhoto",
		ID:   DecryptedMessageMediaPhotoTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaPhoto) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaPhoto#f1fa8d78 as nil")
	}
	b.PutID(DecryptedMessageMediaPhotoTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaPhoto) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaPhoto#f1fa8d78 as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutInt(d.W)
	b.PutInt(d.H)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	b.PutString(d.Caption)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaPhoto) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaPhoto#f1fa8d78 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaPhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaPhoto) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaPhoto#f1fa8d78 to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field w: %w", err)
		}
		d.W = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field h: %w", err)
		}
		d.H = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field iv: %w", err)
		}
		d.Iv = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaPhoto#f1fa8d78: field caption: %w", err)
		}
		d.Caption = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaPhoto) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaPhoto) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaPhoto) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetW returns value of W field.
func (d *DecryptedMessageMediaPhoto) GetW() (value int) {
	if d == nil {
		return
	}
	return d.W
}

// GetH returns value of H field.
func (d *DecryptedMessageMediaPhoto) GetH() (value int) {
	if d == nil {
		return
	}
	return d.H
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaPhoto) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaPhoto) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaPhoto) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

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

// DecryptedMessageMediaVideo represents TL type `decryptedMessageMediaVideo#970c8c0e`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaVideo for reference.
type DecryptedMessageMediaVideo struct {
	// Thumb field of DecryptedMessageMediaVideo.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaVideo.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaVideo.
	ThumbH int
	// Duration field of DecryptedMessageMediaVideo.
	Duration int
	// MimeType field of DecryptedMessageMediaVideo.
	MimeType string
	// W field of DecryptedMessageMediaVideo.
	W int
	// H field of DecryptedMessageMediaVideo.
	H int
	// Size field of DecryptedMessageMediaVideo.
	Size int
	// Key field of DecryptedMessageMediaVideo.
	Key []byte
	// Iv field of DecryptedMessageMediaVideo.
	Iv []byte
	// Caption field of DecryptedMessageMediaVideo.
	Caption string
}

// DecryptedMessageMediaVideoTypeID is TL type id of DecryptedMessageMediaVideo.
const DecryptedMessageMediaVideoTypeID = 0x970c8c0e

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaVideo) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaVideo{}
)

func (d *DecryptedMessageMediaVideo) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.Duration == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.W == 0) {
		return false
	}
	if !(d.H == 0) {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}
	if !(d.Caption == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaVideo) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaVideo",
		ID:   DecryptedMessageMediaVideoTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "Duration",
			SchemaName: "duration",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaVideo) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo#970c8c0e as nil")
	}
	b.PutID(DecryptedMessageMediaVideoTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaVideo) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVideo#970c8c0e as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutInt(d.Duration)
	b.PutString(d.MimeType)
	b.PutInt(d.W)
	b.PutInt(d.H)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	b.PutString(d.Caption)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaVideo) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo#970c8c0e to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaVideoTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaVideo) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVideo#970c8c0e to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field duration: %w", err)
		}
		d.Duration = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field w: %w", err)
		}
		d.W = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field h: %w", err)
		}
		d.H = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field iv: %w", err)
		}
		d.Iv = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVideo#970c8c0e: field caption: %w", err)
		}
		d.Caption = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaVideo) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaVideo) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaVideo) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetDuration returns value of Duration field.
func (d *DecryptedMessageMediaVideo) GetDuration() (value int) {
	if d == nil {
		return
	}
	return d.Duration
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaVideo) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetW returns value of W field.
func (d *DecryptedMessageMediaVideo) GetW() (value int) {
	if d == nil {
		return
	}
	return d.W
}

// GetH returns value of H field.
func (d *DecryptedMessageMediaVideo) GetH() (value int) {
	if d == nil {
		return
	}
	return d.H
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaVideo) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaVideo) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaVideo) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

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

// DecryptedMessageMediaDocument46 represents TL type `decryptedMessageMediaDocument46#7afe8ae2`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaDocument46 for reference.
type DecryptedMessageMediaDocument46 struct {
	// Thumb field of DecryptedMessageMediaDocument46.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaDocument46.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaDocument46.
	ThumbH int
	// MimeType field of DecryptedMessageMediaDocument46.
	MimeType string
	// Size field of DecryptedMessageMediaDocument46.
	Size int
	// Key field of DecryptedMessageMediaDocument46.
	Key []byte
	// Iv field of DecryptedMessageMediaDocument46.
	Iv []byte
	// Attributes field of DecryptedMessageMediaDocument46.
	Attributes []DocumentAttributeClass
	// Caption field of DecryptedMessageMediaDocument46.
	Caption string
}

// DecryptedMessageMediaDocument46TypeID is TL type id of DecryptedMessageMediaDocument46.
const DecryptedMessageMediaDocument46TypeID = 0x7afe8ae2

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaDocument46) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaDocument46{}
)

func (d *DecryptedMessageMediaDocument46) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}
	if !(d.Attributes == nil) {
		return false
	}
	if !(d.Caption == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaDocument46) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaDocument46",
		ID:   DecryptedMessageMediaDocument46TypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
		{
			Name:       "Attributes",
			SchemaName: "attributes",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaDocument46) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument46#7afe8ae2 as nil")
	}
	b.PutID(DecryptedMessageMediaDocument46TypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaDocument46) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument46#7afe8ae2 as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutString(d.MimeType)
	b.PutInt(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	b.PutVectorHeader(len(d.Attributes))
	for idx, v := range d.Attributes {
		if v == nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaDocument46#7afe8ae2: field attributes element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaDocument46#7afe8ae2: field attributes element with index %d: %w", idx, err)
		}
	}
	b.PutString(d.Caption)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaDocument46) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument46#7afe8ae2 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaDocument46TypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaDocument46) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument46#7afe8ae2 to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field iv: %w", err)
		}
		d.Iv = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field attributes: %w", err)
		}

		if headerLen > 0 {
			d.Attributes = make([]DocumentAttributeClass, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := DecodeDocumentAttribute(b)
			if err != nil {
				return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field attributes: %w", err)
			}
			d.Attributes = append(d.Attributes, value)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument46#7afe8ae2: field caption: %w", err)
		}
		d.Caption = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaDocument46) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaDocument46) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaDocument46) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaDocument46) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaDocument46) GetSize() (value int) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaDocument46) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaDocument46) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// GetAttributes returns value of Attributes field.
func (d *DecryptedMessageMediaDocument46) GetAttributes() (value []DocumentAttributeClass) {
	if d == nil {
		return
	}
	return d.Attributes
}

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

// DecryptedMessageMediaVenue represents TL type `decryptedMessageMediaVenue#8a0df56f`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaVenue for reference.
type DecryptedMessageMediaVenue struct {
	// Lat field of DecryptedMessageMediaVenue.
	Lat float64
	// Long field of DecryptedMessageMediaVenue.
	Long float64
	// Title field of DecryptedMessageMediaVenue.
	Title string
	// Address field of DecryptedMessageMediaVenue.
	Address string
	// Provider field of DecryptedMessageMediaVenue.
	Provider string
	// VenueID field of DecryptedMessageMediaVenue.
	VenueID string
}

// DecryptedMessageMediaVenueTypeID is TL type id of DecryptedMessageMediaVenue.
const DecryptedMessageMediaVenueTypeID = 0x8a0df56f

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaVenue) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaVenue{}
)

func (d *DecryptedMessageMediaVenue) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Lat == 0) {
		return false
	}
	if !(d.Long == 0) {
		return false
	}
	if !(d.Title == "") {
		return false
	}
	if !(d.Address == "") {
		return false
	}
	if !(d.Provider == "") {
		return false
	}
	if !(d.VenueID == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaVenue) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaVenue",
		ID:   DecryptedMessageMediaVenueTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Lat",
			SchemaName: "lat",
		},
		{
			Name:       "Long",
			SchemaName: "long",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Address",
			SchemaName: "address",
		},
		{
			Name:       "Provider",
			SchemaName: "provider",
		},
		{
			Name:       "VenueID",
			SchemaName: "venue_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaVenue) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVenue#8a0df56f as nil")
	}
	b.PutID(DecryptedMessageMediaVenueTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaVenue) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaVenue#8a0df56f as nil")
	}
	b.PutDouble(d.Lat)
	b.PutDouble(d.Long)
	b.PutString(d.Title)
	b.PutString(d.Address)
	b.PutString(d.Provider)
	b.PutString(d.VenueID)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaVenue) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVenue#8a0df56f to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaVenueTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaVenue) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaVenue#8a0df56f to nil")
	}
	{
		value, err := b.Double()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field lat: %w", err)
		}
		d.Lat = value
	}
	{
		value, err := b.Double()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field long: %w", err)
		}
		d.Long = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field title: %w", err)
		}
		d.Title = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field address: %w", err)
		}
		d.Address = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field provider: %w", err)
		}
		d.Provider = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaVenue#8a0df56f: field venue_id: %w", err)
		}
		d.VenueID = value
	}
	return nil
}

// GetLat returns value of Lat field.
func (d *DecryptedMessageMediaVenue) GetLat() (value float64) {
	if d == nil {
		return
	}
	return d.Lat
}

// GetLong returns value of Long field.
func (d *DecryptedMessageMediaVenue) GetLong() (value float64) {
	if d == nil {
		return
	}
	return d.Long
}

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

// GetAddress returns value of Address field.
func (d *DecryptedMessageMediaVenue) GetAddress() (value string) {
	if d == nil {
		return
	}
	return d.Address
}

// GetProvider returns value of Provider field.
func (d *DecryptedMessageMediaVenue) GetProvider() (value string) {
	if d == nil {
		return
	}
	return d.Provider
}

// GetVenueID returns value of VenueID field.
func (d *DecryptedMessageMediaVenue) GetVenueID() (value string) {
	if d == nil {
		return
	}
	return d.VenueID
}

// DecryptedMessageMediaWebPage represents TL type `decryptedMessageMediaWebPage#e50511d8`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaWebPage for reference.
type DecryptedMessageMediaWebPage struct {
	// URL field of DecryptedMessageMediaWebPage.
	URL string
}

// DecryptedMessageMediaWebPageTypeID is TL type id of DecryptedMessageMediaWebPage.
const DecryptedMessageMediaWebPageTypeID = 0xe50511d8

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaWebPage) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaWebPage{}
)

func (d *DecryptedMessageMediaWebPage) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.URL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaWebPage) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaWebPage",
		ID:   DecryptedMessageMediaWebPageTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaWebPage) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaWebPage#e50511d8 as nil")
	}
	b.PutID(DecryptedMessageMediaWebPageTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaWebPage) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaWebPage#e50511d8 as nil")
	}
	b.PutString(d.URL)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaWebPage) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaWebPage#e50511d8 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaWebPageTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaWebPage#e50511d8: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaWebPage) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaWebPage#e50511d8 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaWebPage#e50511d8: field url: %w", err)
		}
		d.URL = value
	}
	return nil
}

// GetURL returns value of URL field.
func (d *DecryptedMessageMediaWebPage) GetURL() (value string) {
	if d == nil {
		return
	}
	return d.URL
}

// DecryptedMessageMediaDocument represents TL type `decryptedMessageMediaDocument#6abd9782`.
//
// See https://core.telegram.org/constructor/decryptedMessageMediaDocument for reference.
type DecryptedMessageMediaDocument struct {
	// Thumb field of DecryptedMessageMediaDocument.
	Thumb []byte
	// ThumbW field of DecryptedMessageMediaDocument.
	ThumbW int
	// ThumbH field of DecryptedMessageMediaDocument.
	ThumbH int
	// MimeType field of DecryptedMessageMediaDocument.
	MimeType string
	// Size field of DecryptedMessageMediaDocument.
	Size int64
	// Key field of DecryptedMessageMediaDocument.
	Key []byte
	// Iv field of DecryptedMessageMediaDocument.
	Iv []byte
	// Attributes field of DecryptedMessageMediaDocument.
	Attributes []DocumentAttributeClass
	// Caption field of DecryptedMessageMediaDocument.
	Caption string
}

// DecryptedMessageMediaDocumentTypeID is TL type id of DecryptedMessageMediaDocument.
const DecryptedMessageMediaDocumentTypeID = 0x6abd9782

// construct implements constructor of DecryptedMessageMediaClass.
func (d DecryptedMessageMediaDocument) construct() DecryptedMessageMediaClass { return &d }

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

	_ DecryptedMessageMediaClass = &DecryptedMessageMediaDocument{}
)

func (d *DecryptedMessageMediaDocument) Zero() bool {
	if d == nil {
		return true
	}
	if !(d.Thumb == nil) {
		return false
	}
	if !(d.ThumbW == 0) {
		return false
	}
	if !(d.ThumbH == 0) {
		return false
	}
	if !(d.MimeType == "") {
		return false
	}
	if !(d.Size == 0) {
		return false
	}
	if !(d.Key == nil) {
		return false
	}
	if !(d.Iv == nil) {
		return false
	}
	if !(d.Attributes == nil) {
		return false
	}
	if !(d.Caption == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (d *DecryptedMessageMediaDocument) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "decryptedMessageMediaDocument",
		ID:   DecryptedMessageMediaDocumentTypeID,
	}
	if d == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Thumb",
			SchemaName: "thumb",
		},
		{
			Name:       "ThumbW",
			SchemaName: "thumb_w",
		},
		{
			Name:       "ThumbH",
			SchemaName: "thumb_h",
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Iv",
			SchemaName: "iv",
		},
		{
			Name:       "Attributes",
			SchemaName: "attributes",
		},
		{
			Name:       "Caption",
			SchemaName: "caption",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (d *DecryptedMessageMediaDocument) Encode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument#6abd9782 as nil")
	}
	b.PutID(DecryptedMessageMediaDocumentTypeID)
	return d.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (d *DecryptedMessageMediaDocument) EncodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't encode decryptedMessageMediaDocument#6abd9782 as nil")
	}
	b.PutBytes(d.Thumb)
	b.PutInt(d.ThumbW)
	b.PutInt(d.ThumbH)
	b.PutString(d.MimeType)
	b.PutLong(d.Size)
	b.PutBytes(d.Key)
	b.PutBytes(d.Iv)
	b.PutVectorHeader(len(d.Attributes))
	for idx, v := range d.Attributes {
		if v == nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaDocument#6abd9782: field attributes element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode decryptedMessageMediaDocument#6abd9782: field attributes element with index %d: %w", idx, err)
		}
	}
	b.PutString(d.Caption)
	return nil
}

// Decode implements bin.Decoder.
func (d *DecryptedMessageMediaDocument) Decode(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument#6abd9782 to nil")
	}
	if err := b.ConsumeID(DecryptedMessageMediaDocumentTypeID); err != nil {
		return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: %w", err)
	}
	return d.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (d *DecryptedMessageMediaDocument) DecodeBare(b *bin.Buffer) error {
	if d == nil {
		return fmt.Errorf("can't decode decryptedMessageMediaDocument#6abd9782 to nil")
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field thumb: %w", err)
		}
		d.Thumb = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field thumb_w: %w", err)
		}
		d.ThumbW = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field thumb_h: %w", err)
		}
		d.ThumbH = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field mime_type: %w", err)
		}
		d.MimeType = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field size: %w", err)
		}
		d.Size = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field key: %w", err)
		}
		d.Key = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field iv: %w", err)
		}
		d.Iv = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field attributes: %w", err)
		}

		if headerLen > 0 {
			d.Attributes = make([]DocumentAttributeClass, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := DecodeDocumentAttribute(b)
			if err != nil {
				return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field attributes: %w", err)
			}
			d.Attributes = append(d.Attributes, value)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode decryptedMessageMediaDocument#6abd9782: field caption: %w", err)
		}
		d.Caption = value
	}
	return nil
}

// GetThumb returns value of Thumb field.
func (d *DecryptedMessageMediaDocument) GetThumb() (value []byte) {
	if d == nil {
		return
	}
	return d.Thumb
}

// GetThumbW returns value of ThumbW field.
func (d *DecryptedMessageMediaDocument) GetThumbW() (value int) {
	if d == nil {
		return
	}
	return d.ThumbW
}

// GetThumbH returns value of ThumbH field.
func (d *DecryptedMessageMediaDocument) GetThumbH() (value int) {
	if d == nil {
		return
	}
	return d.ThumbH
}

// GetMimeType returns value of MimeType field.
func (d *DecryptedMessageMediaDocument) GetMimeType() (value string) {
	if d == nil {
		return
	}
	return d.MimeType
}

// GetSize returns value of Size field.
func (d *DecryptedMessageMediaDocument) GetSize() (value int64) {
	if d == nil {
		return
	}
	return d.Size
}

// GetKey returns value of Key field.
func (d *DecryptedMessageMediaDocument) GetKey() (value []byte) {
	if d == nil {
		return
	}
	return d.Key
}

// GetIv returns value of Iv field.
func (d *DecryptedMessageMediaDocument) GetIv() (value []byte) {
	if d == nil {
		return
	}
	return d.Iv
}

// GetAttributes returns value of Attributes field.
func (d *DecryptedMessageMediaDocument) GetAttributes() (value []DocumentAttributeClass) {
	if d == nil {
		return
	}
	return d.Attributes
}

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

// DecryptedMessageMediaClassName is schema name of DecryptedMessageMediaClass.
const DecryptedMessageMediaClassName = "DecryptedMessageMedia"

// DecryptedMessageMediaClass represents DecryptedMessageMedia generic type.
//
// See https://core.telegram.org/type/DecryptedMessageMedia for reference.
//
// Example:
//
//	g, err := e2e.DecodeDecryptedMessageMedia(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *e2e.DecryptedMessageMediaEmpty: // decryptedMessageMediaEmpty#89f5c4a
//	case *e2e.DecryptedMessageMediaPhoto8: // decryptedMessageMediaPhoto8#32798a8c
//	case *e2e.DecryptedMessageMediaVideo8: // decryptedMessageMediaVideo8#4cee6ef3
//	case *e2e.DecryptedMessageMediaGeoPoint: // decryptedMessageMediaGeoPoint#35480a59
//	case *e2e.DecryptedMessageMediaContact: // decryptedMessageMediaContact#588a0a97
//	case *e2e.DecryptedMessageMediaDocument8: // decryptedMessageMediaDocument8#b095434b
//	case *e2e.DecryptedMessageMediaAudio8: // decryptedMessageMediaAudio8#6080758f
//	case *e2e.DecryptedMessageMediaVideo23: // decryptedMessageMediaVideo23#524a415d
//	case *e2e.DecryptedMessageMediaAudio: // decryptedMessageMediaAudio#57e0a9cb
//	case *e2e.DecryptedMessageMediaExternalDocument: // decryptedMessageMediaExternalDocument#fa95b0dd
//	case *e2e.DecryptedMessageMediaPhoto: // decryptedMessageMediaPhoto#f1fa8d78
//	case *e2e.DecryptedMessageMediaVideo: // decryptedMessageMediaVideo#970c8c0e
//	case *e2e.DecryptedMessageMediaDocument46: // decryptedMessageMediaDocument46#7afe8ae2
//	case *e2e.DecryptedMessageMediaVenue: // decryptedMessageMediaVenue#8a0df56f
//	case *e2e.DecryptedMessageMediaWebPage: // decryptedMessageMediaWebPage#e50511d8
//	case *e2e.DecryptedMessageMediaDocument: // decryptedMessageMediaDocument#6abd9782
//	default: panic(v)
//	}
type DecryptedMessageMediaClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() DecryptedMessageMediaClass

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

// DecodeDecryptedMessageMedia implements binary de-serialization for DecryptedMessageMediaClass.
func DecodeDecryptedMessageMedia(buf *bin.Buffer) (DecryptedMessageMediaClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case DecryptedMessageMediaEmptyTypeID:
		// Decoding decryptedMessageMediaEmpty#89f5c4a.
		v := DecryptedMessageMediaEmpty{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaPhoto8TypeID:
		// Decoding decryptedMessageMediaPhoto8#32798a8c.
		v := DecryptedMessageMediaPhoto8{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaVideo8TypeID:
		// Decoding decryptedMessageMediaVideo8#4cee6ef3.
		v := DecryptedMessageMediaVideo8{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaGeoPointTypeID:
		// Decoding decryptedMessageMediaGeoPoint#35480a59.
		v := DecryptedMessageMediaGeoPoint{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaContactTypeID:
		// Decoding decryptedMessageMediaContact#588a0a97.
		v := DecryptedMessageMediaContact{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaDocument8TypeID:
		// Decoding decryptedMessageMediaDocument8#b095434b.
		v := DecryptedMessageMediaDocument8{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaAudio8TypeID:
		// Decoding decryptedMessageMediaAudio8#6080758f.
		v := DecryptedMessageMediaAudio8{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaVideo23TypeID:
		// Decoding decryptedMessageMediaVideo23#524a415d.
		v := DecryptedMessageMediaVideo23{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaAudioTypeID:
		// Decoding decryptedMessageMediaAudio#57e0a9cb.
		v := DecryptedMessageMediaAudio{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaExternalDocumentTypeID:
		// Decoding decryptedMessageMediaExternalDocument#fa95b0dd.
		v := DecryptedMessageMediaExternalDocument{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaPhotoTypeID:
		// Decoding decryptedMessageMediaPhoto#f1fa8d78.
		v := DecryptedMessageMediaPhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaVideoTypeID:
		// Decoding decryptedMessageMediaVideo#970c8c0e.
		v := DecryptedMessageMediaVideo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaDocument46TypeID:
		// Decoding decryptedMessageMediaDocument46#7afe8ae2.
		v := DecryptedMessageMediaDocument46{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaVenueTypeID:
		// Decoding decryptedMessageMediaVenue#8a0df56f.
		v := DecryptedMessageMediaVenue{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaWebPageTypeID:
		// Decoding decryptedMessageMediaWebPage#e50511d8.
		v := DecryptedMessageMediaWebPage{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	case DecryptedMessageMediaDocumentTypeID:
		// Decoding decryptedMessageMediaDocument#6abd9782.
		v := DecryptedMessageMediaDocument{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode DecryptedMessageMediaClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecryptedMessageMedia boxes the DecryptedMessageMediaClass providing a helper.
type DecryptedMessageMediaBox struct {
	DecryptedMessageMedia DecryptedMessageMediaClass
}

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

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