// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

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

// MessageReplyHeader represents TL type `messageReplyHeader#afbc09db`.
// Message replies and thread¹ information
//
// Links:
//  1. https://core.telegram.org/api/threads
//
// See https://core.telegram.org/constructor/messageReplyHeader for reference.
type MessageReplyHeader struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// This is a reply to a scheduled message.
	ReplyToScheduled bool
	// Whether this message was sent in a forum topic¹ (except for the General topic).
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#forum-topics
	ForumTopic bool
	// Whether this message is quoting a part of another message.
	Quote bool
	// ID of message to which this message is replying
	//
	// Use SetReplyToMsgID and GetReplyToMsgID helpers.
	ReplyToMsgID int
	// For replies sent in channel discussion threads¹ of which the current user is not a
	// member, the discussion group ID
	//
	// Links:
	//  1) https://core.telegram.org/api/threads
	//
	// Use SetReplyToPeerID and GetReplyToPeerID helpers.
	ReplyToPeerID PeerClass
	// When replying to a message sent by a certain peer to another chat, contains info about
	// the peer that originally sent the message to that other chat.
	//
	// Use SetReplyFrom and GetReplyFrom helpers.
	ReplyFrom MessageFwdHeader
	// When replying to a media sent by a certain peer to another chat, contains the media of
	// the replied-to message.
	//
	// Use SetReplyMedia and GetReplyMedia helpers.
	ReplyMedia MessageMediaClass
	// ID of the message that started this message thread¹
	//
	// Links:
	//  1) https://core.telegram.org/api/threads
	//
	// Use SetReplyToTopID and GetReplyToTopID helpers.
	ReplyToTopID int
	// Used to quote-reply to only a certain section (specified here) of the original message.
	//
	// Use SetQuoteText and GetQuoteText helpers.
	QuoteText string
	// Message entities for styled text¹ from the quote_text field.
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetQuoteEntities and GetQuoteEntities helpers.
	QuoteEntities []MessageEntityClass
	// Offset of the message quote_text within the original message (in UTF-16 code units¹).
	//
	// Links:
	//  1) https://core.telegram.org/api/entities#entity-length
	//
	// Use SetQuoteOffset and GetQuoteOffset helpers.
	QuoteOffset int
}

// MessageReplyHeaderTypeID is TL type id of MessageReplyHeader.
const MessageReplyHeaderTypeID = 0xafbc09db

// construct implements constructor of MessageReplyHeaderClass.
func ( MessageReplyHeader) () MessageReplyHeaderClass { return & }

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

	_ MessageReplyHeaderClass = &MessageReplyHeader{}
)

func ( *MessageReplyHeader) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ReplyToScheduled == false) {
		return false
	}
	if !(.ForumTopic == false) {
		return false
	}
	if !(.Quote == false) {
		return false
	}
	if !(.ReplyToMsgID == 0) {
		return false
	}
	if !(.ReplyToPeerID == nil) {
		return false
	}
	if !(.ReplyFrom.Zero()) {
		return false
	}
	if !(.ReplyMedia == nil) {
		return false
	}
	if !(.ReplyToTopID == 0) {
		return false
	}
	if !(.QuoteText == "") {
		return false
	}
	if !(.QuoteEntities == nil) {
		return false
	}
	if !(.QuoteOffset == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageReplyHeader from given interface.
func ( *MessageReplyHeader) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( int,  bool)
	() ( PeerClass,  bool)
	() ( MessageFwdHeader,  bool)
	() ( MessageMediaClass,  bool)
	() ( int,  bool)
	() ( string,  bool)
	() ( []MessageEntityClass,  bool)
	() ( int,  bool)
}) {
	.ReplyToScheduled = .()
	.ForumTopic = .()
	.Quote = .()
	if ,  := .();  {
		.ReplyToMsgID = 
	}

	if ,  := .();  {
		.ReplyToPeerID = 
	}

	if ,  := .();  {
		.ReplyFrom = 
	}

	if ,  := .();  {
		.ReplyMedia = 
	}

	if ,  := .();  {
		.ReplyToTopID = 
	}

	if ,  := .();  {
		.QuoteText = 
	}

	if ,  := .();  {
		.QuoteEntities = 
	}

	if ,  := .();  {
		.QuoteOffset = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageReplyHeader) () tdp.Type {
	 := tdp.Type{
		Name: "messageReplyHeader",
		ID:   MessageReplyHeaderTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ReplyToScheduled",
			SchemaName: "reply_to_scheduled",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "ForumTopic",
			SchemaName: "forum_topic",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Quote",
			SchemaName: "quote",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "ReplyToMsgID",
			SchemaName: "reply_to_msg_id",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "ReplyToPeerID",
			SchemaName: "reply_to_peer_id",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ReplyFrom",
			SchemaName: "reply_from",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "ReplyMedia",
			SchemaName: "reply_media",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "ReplyToTopID",
			SchemaName: "reply_to_top_id",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "QuoteText",
			SchemaName: "quote_text",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "QuoteEntities",
			SchemaName: "quote_entities",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "QuoteOffset",
			SchemaName: "quote_offset",
			Null:       !.Flags.Has(10),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageReplyHeader) () {
	if !(.ReplyToScheduled == false) {
		.Flags.Set(2)
	}
	if !(.ForumTopic == false) {
		.Flags.Set(3)
	}
	if !(.Quote == false) {
		.Flags.Set(9)
	}
	if !(.ReplyToMsgID == 0) {
		.Flags.Set(4)
	}
	if !(.ReplyToPeerID == nil) {
		.Flags.Set(0)
	}
	if !(.ReplyFrom.Zero()) {
		.Flags.Set(5)
	}
	if !(.ReplyMedia == nil) {
		.Flags.Set(8)
	}
	if !(.ReplyToTopID == 0) {
		.Flags.Set(1)
	}
	if !(.QuoteText == "") {
		.Flags.Set(6)
	}
	if !(.QuoteEntities == nil) {
		.Flags.Set(7)
	}
	if !(.QuoteOffset == 0) {
		.Flags.Set(10)
	}
}

// Encode implements bin.Encoder.
func ( *MessageReplyHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageReplyHeader#afbc09db as nil")
	}
	.PutID(MessageReplyHeaderTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageReplyHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageReplyHeader#afbc09db as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field flags: %w", )
	}
	if .Flags.Has(4) {
		.PutInt(.ReplyToMsgID)
	}
	if .Flags.Has(0) {
		if .ReplyToPeerID == nil {
			return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_to_peer_id is nil")
		}
		if  := .ReplyToPeerID.Encode();  != nil {
			return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_to_peer_id: %w", )
		}
	}
	if .Flags.Has(5) {
		if  := .ReplyFrom.Encode();  != nil {
			return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_from: %w", )
		}
	}
	if .Flags.Has(8) {
		if .ReplyMedia == nil {
			return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_media is nil")
		}
		if  := .ReplyMedia.Encode();  != nil {
			return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_media: %w", )
		}
	}
	if .Flags.Has(1) {
		.PutInt(.ReplyToTopID)
	}
	if .Flags.Has(6) {
		.PutString(.QuoteText)
	}
	if .Flags.Has(7) {
		.PutVectorHeader(len(.QuoteEntities))
		for ,  := range .QuoteEntities {
			if  == nil {
				return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field quote_entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field quote_entities element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(10) {
		.PutInt(.QuoteOffset)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageReplyHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageReplyHeader#afbc09db to nil")
	}
	if  := .ConsumeID(MessageReplyHeaderTypeID);  != nil {
		return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageReplyHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageReplyHeader#afbc09db to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field flags: %w", )
		}
	}
	.ReplyToScheduled = .Flags.Has(2)
	.ForumTopic = .Flags.Has(3)
	.Quote = .Flags.Has(9)
	if .Flags.Has(4) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_msg_id: %w", )
		}
		.ReplyToMsgID = 
	}
	if .Flags.Has(0) {
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_peer_id: %w", )
		}
		.ReplyToPeerID = 
	}
	if .Flags.Has(5) {
		if  := .ReplyFrom.Decode();  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_from: %w", )
		}
	}
	if .Flags.Has(8) {
		,  := DecodeMessageMedia()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_media: %w", )
		}
		.ReplyMedia = 
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_top_id: %w", )
		}
		.ReplyToTopID = 
	}
	if .Flags.Has(6) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_text: %w", )
		}
		.QuoteText = 
	}
	if .Flags.Has(7) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_entities: %w", )
		}

		if  > 0 {
			.QuoteEntities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_entities: %w", )
			}
			.QuoteEntities = append(.QuoteEntities, )
		}
	}
	if .Flags.Has(10) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_offset: %w", )
		}
		.QuoteOffset = 
	}
	return nil
}

// SetReplyToScheduled sets value of ReplyToScheduled conditional field.
func ( *MessageReplyHeader) ( bool) {
	if  {
		.Flags.Set(2)
		.ReplyToScheduled = true
	} else {
		.Flags.Unset(2)
		.ReplyToScheduled = false
	}
}

// GetReplyToScheduled returns value of ReplyToScheduled conditional field.
func ( *MessageReplyHeader) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetForumTopic sets value of ForumTopic conditional field.
func ( *MessageReplyHeader) ( bool) {
	if  {
		.Flags.Set(3)
		.ForumTopic = true
	} else {
		.Flags.Unset(3)
		.ForumTopic = false
	}
}

// GetForumTopic returns value of ForumTopic conditional field.
func ( *MessageReplyHeader) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetQuote sets value of Quote conditional field.
func ( *MessageReplyHeader) ( bool) {
	if  {
		.Flags.Set(9)
		.Quote = true
	} else {
		.Flags.Unset(9)
		.Quote = false
	}
}

// GetQuote returns value of Quote conditional field.
func ( *MessageReplyHeader) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetReplyToMsgID sets value of ReplyToMsgID conditional field.
func ( *MessageReplyHeader) ( int) {
	.Flags.Set(4)
	.ReplyToMsgID = 
}

// GetReplyToMsgID returns value of ReplyToMsgID conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .ReplyToMsgID, true
}

// SetReplyToPeerID sets value of ReplyToPeerID conditional field.
func ( *MessageReplyHeader) ( PeerClass) {
	.Flags.Set(0)
	.ReplyToPeerID = 
}

// GetReplyToPeerID returns value of ReplyToPeerID conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( PeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .ReplyToPeerID, true
}

// SetReplyFrom sets value of ReplyFrom conditional field.
func ( *MessageReplyHeader) ( MessageFwdHeader) {
	.Flags.Set(5)
	.ReplyFrom = 
}

// GetReplyFrom returns value of ReplyFrom conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( MessageFwdHeader,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .ReplyFrom, true
}

// SetReplyMedia sets value of ReplyMedia conditional field.
func ( *MessageReplyHeader) ( MessageMediaClass) {
	.Flags.Set(8)
	.ReplyMedia = 
}

// GetReplyMedia returns value of ReplyMedia conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( MessageMediaClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(8) {
		return , false
	}
	return .ReplyMedia, true
}

// SetReplyToTopID sets value of ReplyToTopID conditional field.
func ( *MessageReplyHeader) ( int) {
	.Flags.Set(1)
	.ReplyToTopID = 
}

// GetReplyToTopID returns value of ReplyToTopID conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .ReplyToTopID, true
}

// SetQuoteText sets value of QuoteText conditional field.
func ( *MessageReplyHeader) ( string) {
	.Flags.Set(6)
	.QuoteText = 
}

// GetQuoteText returns value of QuoteText conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(6) {
		return , false
	}
	return .QuoteText, true
}

// SetQuoteEntities sets value of QuoteEntities conditional field.
func ( *MessageReplyHeader) ( []MessageEntityClass) {
	.Flags.Set(7)
	.QuoteEntities = 
}

// GetQuoteEntities returns value of QuoteEntities conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( []MessageEntityClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(7) {
		return , false
	}
	return .QuoteEntities, true
}

// SetQuoteOffset sets value of QuoteOffset conditional field.
func ( *MessageReplyHeader) ( int) {
	.Flags.Set(10)
	.QuoteOffset = 
}

// GetQuoteOffset returns value of QuoteOffset conditional field and
// boolean which is true if field was set.
func ( *MessageReplyHeader) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .QuoteOffset, true
}

// MapQuoteEntities returns field QuoteEntities wrapped in MessageEntityClassArray helper.
func ( *MessageReplyHeader) () ( MessageEntityClassArray,  bool) {
	if !.Flags.Has(7) {
		return , false
	}
	return MessageEntityClassArray(.QuoteEntities), true
}

// MessageReplyStoryHeader represents TL type `messageReplyStoryHeader#9c98bfc1`.
// Represents a reply to a story¹
//
// Links:
//  1. https://core.telegram.org/api/stories
//
// See https://core.telegram.org/constructor/messageReplyStoryHeader for reference.
type MessageReplyStoryHeader struct {
	// ID of the user that posted a story
	UserID int64
	// Story ID
	StoryID int
}

// MessageReplyStoryHeaderTypeID is TL type id of MessageReplyStoryHeader.
const MessageReplyStoryHeaderTypeID = 0x9c98bfc1

// construct implements constructor of MessageReplyHeaderClass.
func ( MessageReplyStoryHeader) () MessageReplyHeaderClass { return & }

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

	_ MessageReplyHeaderClass = &MessageReplyStoryHeader{}
)

func ( *MessageReplyStoryHeader) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == 0) {
		return false
	}
	if !(.StoryID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageReplyStoryHeader from given interface.
func ( *MessageReplyStoryHeader) ( interface {
	() ( int64)
	() ( int)
}) {
	.UserID = .()
	.StoryID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageReplyStoryHeader) () tdp.Type {
	 := tdp.Type{
		Name: "messageReplyStoryHeader",
		ID:   MessageReplyStoryHeaderTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "StoryID",
			SchemaName: "story_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageReplyStoryHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageReplyStoryHeader#9c98bfc1 as nil")
	}
	.PutID(MessageReplyStoryHeaderTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageReplyStoryHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageReplyStoryHeader#9c98bfc1 as nil")
	}
	.PutLong(.UserID)
	.PutInt(.StoryID)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageReplyStoryHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageReplyStoryHeader#9c98bfc1 to nil")
	}
	if  := .ConsumeID(MessageReplyStoryHeaderTypeID);  != nil {
		return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageReplyStoryHeader) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageReplyStoryHeader#9c98bfc1 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: field story_id: %w", )
		}
		.StoryID = 
	}
	return nil
}

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

// GetStoryID returns value of StoryID field.
func ( *MessageReplyStoryHeader) () ( int) {
	if  == nil {
		return
	}
	return .StoryID
}

// MessageReplyHeaderClassName is schema name of MessageReplyHeaderClass.
const MessageReplyHeaderClassName = "MessageReplyHeader"

// MessageReplyHeaderClass represents MessageReplyHeader generic type.
//
// See https://core.telegram.org/type/MessageReplyHeader for reference.
//
// Example:
//
//	g, err := tg.DecodeMessageReplyHeader(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessageReplyHeader: // messageReplyHeader#afbc09db
//	case *tg.MessageReplyStoryHeader: // messageReplyStoryHeader#9c98bfc1
//	default: panic(v)
//	}
type MessageReplyHeaderClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessageReplyHeaderClass

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

// DecodeMessageReplyHeader implements binary de-serialization for MessageReplyHeaderClass.
func ( *bin.Buffer) (MessageReplyHeaderClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessageReplyHeaderTypeID:
		// Decoding messageReplyHeader#afbc09db.
		 := MessageReplyHeader{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", )
		}
		return &, nil
	case MessageReplyStoryHeaderTypeID:
		// Decoding messageReplyStoryHeader#9c98bfc1.
		 := MessageReplyStoryHeader{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", bin.NewUnexpectedID())
	}
}

// MessageReplyHeader boxes the MessageReplyHeaderClass providing a helper.
type MessageReplyHeaderBox struct {
	MessageReplyHeader MessageReplyHeaderClass
}

// Decode implements bin.Decoder for MessageReplyHeaderBox.
func ( *MessageReplyHeaderBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode MessageReplyHeaderBox to nil")
	}
	,  := DecodeMessageReplyHeader()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.MessageReplyHeader = 
	return nil
}

// Encode implements bin.Encode for MessageReplyHeaderBox.
func ( *MessageReplyHeaderBox) ( *bin.Buffer) error {
	if  == nil || .MessageReplyHeader == nil {
		return fmt.Errorf("unable to encode MessageReplyHeaderClass as nil")
	}
	return .MessageReplyHeader.Encode()
}