// Code generated by gotdgen, DO NOT EDIT.

package tdapi

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

	"go.uber.org/multierr"

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

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// ReportReasonSpam represents TL type `reportReasonSpam#b80e23bf`.
type ReportReasonSpam struct {
}

// ReportReasonSpamTypeID is TL type id of ReportReasonSpam.
const ReportReasonSpamTypeID = 0xb80e23bf

// construct implements constructor of ReportReasonClass.
func (r ReportReasonSpam) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonSpam{}
)

func (r *ReportReasonSpam) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonSpam) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonSpam#b80e23bf as nil")
	}
	b.PutID(ReportReasonSpamTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonSpam) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonSpam#b80e23bf as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonSpam) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil")
	}
	if err := b.ConsumeID(ReportReasonSpamTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonSpam#b80e23bf: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonSpam) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonSpam) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil")
	}

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

// ReportReasonViolence represents TL type `reportReasonViolence#7983c739`.
type ReportReasonViolence struct {
}

// ReportReasonViolenceTypeID is TL type id of ReportReasonViolence.
const ReportReasonViolenceTypeID = 0x7983c739

// construct implements constructor of ReportReasonClass.
func (r ReportReasonViolence) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonViolence{}
)

func (r *ReportReasonViolence) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonViolence) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil")
	}
	b.PutID(ReportReasonViolenceTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonViolence) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonViolence) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil")
	}
	if err := b.ConsumeID(ReportReasonViolenceTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonViolence#7983c739: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonViolence) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *ReportReasonViolence) EncodeTDLibJSON(b tdjson.Encoder) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil")
	}
	b.ObjStart()
	b.PutID("reportReasonViolence")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonViolence) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil")
	}

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

// ReportReasonPornography represents TL type `reportReasonPornography#4ddf1cf7`.
type ReportReasonPornography struct {
}

// ReportReasonPornographyTypeID is TL type id of ReportReasonPornography.
const ReportReasonPornographyTypeID = 0x4ddf1cf7

// construct implements constructor of ReportReasonClass.
func (r ReportReasonPornography) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonPornography{}
)

func (r *ReportReasonPornography) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonPornography) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil")
	}
	b.PutID(ReportReasonPornographyTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonPornography) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonPornography) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil")
	}
	if err := b.ConsumeID(ReportReasonPornographyTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonPornography#4ddf1cf7: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonPornography) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *ReportReasonPornography) EncodeTDLibJSON(b tdjson.Encoder) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil")
	}
	b.ObjStart()
	b.PutID("reportReasonPornography")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonPornography) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil")
	}

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

// ReportReasonChildAbuse represents TL type `reportReasonChildAbuse#2d5d42fe`.
type ReportReasonChildAbuse struct {
}

// ReportReasonChildAbuseTypeID is TL type id of ReportReasonChildAbuse.
const ReportReasonChildAbuseTypeID = 0x2d5d42fe

// construct implements constructor of ReportReasonClass.
func (r ReportReasonChildAbuse) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonChildAbuse{}
)

func (r *ReportReasonChildAbuse) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonChildAbuse) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil")
	}
	b.PutID(ReportReasonChildAbuseTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonChildAbuse) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonChildAbuse) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil")
	}
	if err := b.ConsumeID(ReportReasonChildAbuseTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonChildAbuse#2d5d42fe: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonChildAbuse) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *ReportReasonChildAbuse) EncodeTDLibJSON(b tdjson.Encoder) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil")
	}
	b.ObjStart()
	b.PutID("reportReasonChildAbuse")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonChildAbuse) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil")
	}

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

// ReportReasonCopyright represents TL type `reportReasonCopyright#57e22faf`.
type ReportReasonCopyright struct {
}

// ReportReasonCopyrightTypeID is TL type id of ReportReasonCopyright.
const ReportReasonCopyrightTypeID = 0x57e22faf

// construct implements constructor of ReportReasonClass.
func (r ReportReasonCopyright) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonCopyright{}
)

func (r *ReportReasonCopyright) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonCopyright) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil")
	}
	b.PutID(ReportReasonCopyrightTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonCopyright) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonCopyright) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil")
	}
	if err := b.ConsumeID(ReportReasonCopyrightTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonCopyright#57e22faf: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonCopyright) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *ReportReasonCopyright) EncodeTDLibJSON(b tdjson.Encoder) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil")
	}
	b.ObjStart()
	b.PutID("reportReasonCopyright")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonCopyright) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil")
	}

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

// ReportReasonUnrelatedLocation represents TL type `reportReasonUnrelatedLocation#5381830`.
type ReportReasonUnrelatedLocation struct {
}

// ReportReasonUnrelatedLocationTypeID is TL type id of ReportReasonUnrelatedLocation.
const ReportReasonUnrelatedLocationTypeID = 0x5381830

// construct implements constructor of ReportReasonClass.
func (r ReportReasonUnrelatedLocation) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonUnrelatedLocation{}
)

func (r *ReportReasonUnrelatedLocation) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonUnrelatedLocation) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonUnrelatedLocation#5381830 as nil")
	}
	b.PutID(ReportReasonUnrelatedLocationTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonUnrelatedLocation) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonUnrelatedLocation#5381830 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonUnrelatedLocation) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil")
	}
	if err := b.ConsumeID(ReportReasonUnrelatedLocationTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonUnrelatedLocation#5381830: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonUnrelatedLocation) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonUnrelatedLocation) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil")
	}

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

// ReportReasonFake represents TL type `reportReasonFake#15083fe0`.
type ReportReasonFake struct {
}

// ReportReasonFakeTypeID is TL type id of ReportReasonFake.
const ReportReasonFakeTypeID = 0x15083fe0

// construct implements constructor of ReportReasonClass.
func (r ReportReasonFake) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonFake{}
)

func (r *ReportReasonFake) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonFake) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil")
	}
	b.PutID(ReportReasonFakeTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonFake) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonFake) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil")
	}
	if err := b.ConsumeID(ReportReasonFakeTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonFake#15083fe0: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonFake) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *ReportReasonFake) EncodeTDLibJSON(b tdjson.Encoder) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil")
	}
	b.ObjStart()
	b.PutID("reportReasonFake")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonFake) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil")
	}

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

// ReportReasonIllegalDrugs represents TL type `reportReasonIllegalDrugs#fc541220`.
type ReportReasonIllegalDrugs struct {
}

// ReportReasonIllegalDrugsTypeID is TL type id of ReportReasonIllegalDrugs.
const ReportReasonIllegalDrugsTypeID = 0xfc541220

// construct implements constructor of ReportReasonClass.
func (r ReportReasonIllegalDrugs) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonIllegalDrugs{}
)

func (r *ReportReasonIllegalDrugs) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonIllegalDrugs) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonIllegalDrugs#fc541220 as nil")
	}
	b.PutID(ReportReasonIllegalDrugsTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonIllegalDrugs) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonIllegalDrugs#fc541220 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonIllegalDrugs) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil")
	}
	if err := b.ConsumeID(ReportReasonIllegalDrugsTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonIllegalDrugs#fc541220: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonIllegalDrugs) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonIllegalDrugs) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil")
	}

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

// ReportReasonPersonalDetails represents TL type `reportReasonPersonalDetails#a14b9412`.
type ReportReasonPersonalDetails struct {
}

// ReportReasonPersonalDetailsTypeID is TL type id of ReportReasonPersonalDetails.
const ReportReasonPersonalDetailsTypeID = 0xa14b9412

// construct implements constructor of ReportReasonClass.
func (r ReportReasonPersonalDetails) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonPersonalDetails{}
)

func (r *ReportReasonPersonalDetails) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonPersonalDetails) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonPersonalDetails#a14b9412 as nil")
	}
	b.PutID(ReportReasonPersonalDetailsTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonPersonalDetails) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonPersonalDetails#a14b9412 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonPersonalDetails) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil")
	}
	if err := b.ConsumeID(ReportReasonPersonalDetailsTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonPersonalDetails#a14b9412: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonPersonalDetails) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonPersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil")
	}

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

// ReportReasonCustom represents TL type `reportReasonCustom#adb7da73`.
type ReportReasonCustom struct {
}

// ReportReasonCustomTypeID is TL type id of ReportReasonCustom.
const ReportReasonCustomTypeID = 0xadb7da73

// construct implements constructor of ReportReasonClass.
func (r ReportReasonCustom) construct() ReportReasonClass { return &r }

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

	_ ReportReasonClass = &ReportReasonCustom{}
)

func (r *ReportReasonCustom) Zero() bool {
	if r == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (r *ReportReasonCustom) Encode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonCustom#adb7da73 as nil")
	}
	b.PutID(ReportReasonCustomTypeID)
	return r.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (r *ReportReasonCustom) EncodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't encode reportReasonCustom#adb7da73 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (r *ReportReasonCustom) Decode(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil")
	}
	if err := b.ConsumeID(ReportReasonCustomTypeID); err != nil {
		return fmt.Errorf("unable to decode reportReasonCustom#adb7da73: %w", err)
	}
	return r.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (r *ReportReasonCustom) DecodeBare(b *bin.Buffer) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *ReportReasonCustom) DecodeTDLibJSON(b tdjson.Decoder) error {
	if r == nil {
		return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil")
	}

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

// ReportReasonClassName is schema name of ReportReasonClass.
const ReportReasonClassName = "ReportReason"

// ReportReasonClass represents ReportReason generic type.
//
// Example:
//
//	g, err := tdapi.DecodeReportReason(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tdapi.ReportReasonSpam: // reportReasonSpam#b80e23bf
//	case *tdapi.ReportReasonViolence: // reportReasonViolence#7983c739
//	case *tdapi.ReportReasonPornography: // reportReasonPornography#4ddf1cf7
//	case *tdapi.ReportReasonChildAbuse: // reportReasonChildAbuse#2d5d42fe
//	case *tdapi.ReportReasonCopyright: // reportReasonCopyright#57e22faf
//	case *tdapi.ReportReasonUnrelatedLocation: // reportReasonUnrelatedLocation#5381830
//	case *tdapi.ReportReasonFake: // reportReasonFake#15083fe0
//	case *tdapi.ReportReasonIllegalDrugs: // reportReasonIllegalDrugs#fc541220
//	case *tdapi.ReportReasonPersonalDetails: // reportReasonPersonalDetails#a14b9412
//	case *tdapi.ReportReasonCustom: // reportReasonCustom#adb7da73
//	default: panic(v)
//	}
type ReportReasonClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() ReportReasonClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	EncodeTDLibJSON(b tdjson.Encoder) error
	DecodeTDLibJSON(b tdjson.Decoder) error
}

// DecodeReportReason implements binary de-serialization for ReportReasonClass.
func DecodeReportReason(buf *bin.Buffer) (ReportReasonClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case ReportReasonSpamTypeID:
		// Decoding reportReasonSpam#b80e23bf.
		v := ReportReasonSpam{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonViolenceTypeID:
		// Decoding reportReasonViolence#7983c739.
		v := ReportReasonViolence{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonPornographyTypeID:
		// Decoding reportReasonPornography#4ddf1cf7.
		v := ReportReasonPornography{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonChildAbuseTypeID:
		// Decoding reportReasonChildAbuse#2d5d42fe.
		v := ReportReasonChildAbuse{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonCopyrightTypeID:
		// Decoding reportReasonCopyright#57e22faf.
		v := ReportReasonCopyright{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonUnrelatedLocationTypeID:
		// Decoding reportReasonUnrelatedLocation#5381830.
		v := ReportReasonUnrelatedLocation{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonFakeTypeID:
		// Decoding reportReasonFake#15083fe0.
		v := ReportReasonFake{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonIllegalDrugsTypeID:
		// Decoding reportReasonIllegalDrugs#fc541220.
		v := ReportReasonIllegalDrugs{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonPersonalDetailsTypeID:
		// Decoding reportReasonPersonalDetails#a14b9412.
		v := ReportReasonPersonalDetails{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case ReportReasonCustomTypeID:
		// Decoding reportReasonCustom#adb7da73.
		v := ReportReasonCustom{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecodeTDLibJSONReportReason implements binary de-serialization for ReportReasonClass.
func DecodeTDLibJSONReportReason(buf tdjson.Decoder) (ReportReasonClass, error) {
	id, err := buf.FindTypeID()
	if err != nil {
		return nil, err
	}
	switch id {
	case "reportReasonSpam":
		// Decoding reportReasonSpam#b80e23bf.
		v := ReportReasonSpam{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonViolence":
		// Decoding reportReasonViolence#7983c739.
		v := ReportReasonViolence{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonPornography":
		// Decoding reportReasonPornography#4ddf1cf7.
		v := ReportReasonPornography{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonChildAbuse":
		// Decoding reportReasonChildAbuse#2d5d42fe.
		v := ReportReasonChildAbuse{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonCopyright":
		// Decoding reportReasonCopyright#57e22faf.
		v := ReportReasonCopyright{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonUnrelatedLocation":
		// Decoding reportReasonUnrelatedLocation#5381830.
		v := ReportReasonUnrelatedLocation{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonFake":
		// Decoding reportReasonFake#15083fe0.
		v := ReportReasonFake{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonIllegalDrugs":
		// Decoding reportReasonIllegalDrugs#fc541220.
		v := ReportReasonIllegalDrugs{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonPersonalDetails":
		// Decoding reportReasonPersonalDetails#a14b9412.
		v := ReportReasonPersonalDetails{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	case "reportReasonCustom":
		// Decoding reportReasonCustom#adb7da73.
		v := ReportReasonCustom{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", tdjson.NewUnexpectedID(id))
	}
}

// ReportReason boxes the ReportReasonClass providing a helper.
type ReportReasonBox struct {
	ReportReason ReportReasonClass
}

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

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

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

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