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

// StoryView represents TL type `storyView#b0bdeac5`.
// Story¹ view date and reaction information
//
// Links:
//  1. https://core.telegram.org/api/stories
//
// See https://core.telegram.org/constructor/storyView for reference.
type StoryView struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether we have completely blocked¹ this user, including from viewing more of our
	// stories.
	//
	// Links:
	//  1) https://core.telegram.org/api/block
	Blocked bool
	// Whether we have blocked¹ this user from viewing more of our stories.
	//
	// Links:
	//  1) https://core.telegram.org/api/block
	BlockedMyStoriesFrom bool
	// The user that viewed the story
	UserID int64
	// When did the user view the story
	Date int
	// If present, contains the reaction that the user left on the story
	//
	// Use SetReaction and GetReaction helpers.
	Reaction ReactionClass
}

// StoryViewTypeID is TL type id of StoryView.
const StoryViewTypeID = 0xb0bdeac5

// construct implements constructor of StoryViewClass.
func ( StoryView) () StoryViewClass { return & }

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

	_ StoryViewClass = &StoryView{}
)

func ( *StoryView) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Blocked == false) {
		return false
	}
	if !(.BlockedMyStoriesFrom == false) {
		return false
	}
	if !(.UserID == 0) {
		return false
	}
	if !(.Date == 0) {
		return false
	}
	if !(.Reaction == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StoryView from given interface.
func ( *StoryView) ( interface {
	() ( bool)
	() ( bool)
	() ( int64)
	() ( int)
	() ( ReactionClass,  bool)
}) {
	.Blocked = .()
	.BlockedMyStoriesFrom = .()
	.UserID = .()
	.Date = .()
	if ,  := .();  {
		.Reaction = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *StoryView) () tdp.Type {
	 := tdp.Type{
		Name: "storyView",
		ID:   StoryViewTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Blocked",
			SchemaName: "blocked",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "BlockedMyStoriesFrom",
			SchemaName: "blocked_my_stories_from",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "Reaction",
			SchemaName: "reaction",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StoryView) () {
	if !(.Blocked == false) {
		.Flags.Set(0)
	}
	if !(.BlockedMyStoriesFrom == false) {
		.Flags.Set(1)
	}
	if !(.Reaction == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *StoryView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyView#b0bdeac5 as nil")
	}
	.PutID(StoryViewTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StoryView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyView#b0bdeac5 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode storyView#b0bdeac5: field flags: %w", )
	}
	.PutLong(.UserID)
	.PutInt(.Date)
	if .Flags.Has(2) {
		if .Reaction == nil {
			return fmt.Errorf("unable to encode storyView#b0bdeac5: field reaction is nil")
		}
		if  := .Reaction.Encode();  != nil {
			return fmt.Errorf("unable to encode storyView#b0bdeac5: field reaction: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StoryView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode storyView#b0bdeac5 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode storyView#b0bdeac5: field flags: %w", )
		}
	}
	.Blocked = .Flags.Has(0)
	.BlockedMyStoriesFrom = .Flags.Has(1)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode storyView#b0bdeac5: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode storyView#b0bdeac5: field date: %w", )
		}
		.Date = 
	}
	if .Flags.Has(2) {
		,  := DecodeReaction()
		if  != nil {
			return fmt.Errorf("unable to decode storyView#b0bdeac5: field reaction: %w", )
		}
		.Reaction = 
	}
	return nil
}

// SetBlocked sets value of Blocked conditional field.
func ( *StoryView) ( bool) {
	if  {
		.Flags.Set(0)
		.Blocked = true
	} else {
		.Flags.Unset(0)
		.Blocked = false
	}
}

// GetBlocked returns value of Blocked conditional field.
func ( *StoryView) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field.
func ( *StoryView) ( bool) {
	if  {
		.Flags.Set(1)
		.BlockedMyStoriesFrom = true
	} else {
		.Flags.Unset(1)
		.BlockedMyStoriesFrom = false
	}
}

// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field.
func ( *StoryView) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

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

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

// SetReaction sets value of Reaction conditional field.
func ( *StoryView) ( ReactionClass) {
	.Flags.Set(2)
	.Reaction = 
}

// GetReaction returns value of Reaction conditional field and
// boolean which is true if field was set.
func ( *StoryView) () ( ReactionClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Reaction, true
}

// StoryViewPublicForward represents TL type `storyViewPublicForward#9083670b`.
//
// See https://core.telegram.org/constructor/storyViewPublicForward for reference.
type StoryViewPublicForward struct {
	// Flags field of StoryViewPublicForward.
	Flags bin.Fields
	// Blocked field of StoryViewPublicForward.
	Blocked bool
	// BlockedMyStoriesFrom field of StoryViewPublicForward.
	BlockedMyStoriesFrom bool
	// Message field of StoryViewPublicForward.
	Message MessageClass
}

// StoryViewPublicForwardTypeID is TL type id of StoryViewPublicForward.
const StoryViewPublicForwardTypeID = 0x9083670b

// construct implements constructor of StoryViewClass.
func ( StoryViewPublicForward) () StoryViewClass { return & }

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

	_ StoryViewClass = &StoryViewPublicForward{}
)

func ( *StoryViewPublicForward) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Blocked == false) {
		return false
	}
	if !(.BlockedMyStoriesFrom == false) {
		return false
	}
	if !(.Message == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StoryViewPublicForward from given interface.
func ( *StoryViewPublicForward) ( interface {
	() ( bool)
	() ( bool)
	() ( MessageClass)
}) {
	.Blocked = .()
	.BlockedMyStoriesFrom = .()
	.Message = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StoryViewPublicForward) () tdp.Type {
	 := tdp.Type{
		Name: "storyViewPublicForward",
		ID:   StoryViewPublicForwardTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Blocked",
			SchemaName: "blocked",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "BlockedMyStoriesFrom",
			SchemaName: "blocked_my_stories_from",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StoryViewPublicForward) () {
	if !(.Blocked == false) {
		.Flags.Set(0)
	}
	if !(.BlockedMyStoriesFrom == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *StoryViewPublicForward) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyViewPublicForward#9083670b as nil")
	}
	.PutID(StoryViewPublicForwardTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StoryViewPublicForward) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyViewPublicForward#9083670b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field flags: %w", )
	}
	if .Message == nil {
		return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field message is nil")
	}
	if  := .Message.Encode();  != nil {
		return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StoryViewPublicForward) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode storyViewPublicForward#9083670b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode storyViewPublicForward#9083670b: field flags: %w", )
		}
	}
	.Blocked = .Flags.Has(0)
	.BlockedMyStoriesFrom = .Flags.Has(1)
	{
		,  := DecodeMessage()
		if  != nil {
			return fmt.Errorf("unable to decode storyViewPublicForward#9083670b: field message: %w", )
		}
		.Message = 
	}
	return nil
}

// SetBlocked sets value of Blocked conditional field.
func ( *StoryViewPublicForward) ( bool) {
	if  {
		.Flags.Set(0)
		.Blocked = true
	} else {
		.Flags.Unset(0)
		.Blocked = false
	}
}

// GetBlocked returns value of Blocked conditional field.
func ( *StoryViewPublicForward) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field.
func ( *StoryViewPublicForward) ( bool) {
	if  {
		.Flags.Set(1)
		.BlockedMyStoriesFrom = true
	} else {
		.Flags.Unset(1)
		.BlockedMyStoriesFrom = false
	}
}

// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field.
func ( *StoryViewPublicForward) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// GetMessage returns value of Message field.
func ( *StoryViewPublicForward) () ( MessageClass) {
	if  == nil {
		return
	}
	return .Message
}

// StoryViewPublicRepost represents TL type `storyViewPublicRepost#bd74cf49`.
//
// See https://core.telegram.org/constructor/storyViewPublicRepost for reference.
type StoryViewPublicRepost struct {
	// Flags field of StoryViewPublicRepost.
	Flags bin.Fields
	// Blocked field of StoryViewPublicRepost.
	Blocked bool
	// BlockedMyStoriesFrom field of StoryViewPublicRepost.
	BlockedMyStoriesFrom bool
	// PeerID field of StoryViewPublicRepost.
	PeerID PeerClass
	// Story field of StoryViewPublicRepost.
	Story StoryItemClass
}

// StoryViewPublicRepostTypeID is TL type id of StoryViewPublicRepost.
const StoryViewPublicRepostTypeID = 0xbd74cf49

// construct implements constructor of StoryViewClass.
func ( StoryViewPublicRepost) () StoryViewClass { return & }

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

	_ StoryViewClass = &StoryViewPublicRepost{}
)

func ( *StoryViewPublicRepost) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Blocked == false) {
		return false
	}
	if !(.BlockedMyStoriesFrom == false) {
		return false
	}
	if !(.PeerID == nil) {
		return false
	}
	if !(.Story == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StoryViewPublicRepost from given interface.
func ( *StoryViewPublicRepost) ( interface {
	() ( bool)
	() ( bool)
	() ( PeerClass)
	() ( StoryItemClass)
}) {
	.Blocked = .()
	.BlockedMyStoriesFrom = .()
	.PeerID = .()
	.Story = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StoryViewPublicRepost) () tdp.Type {
	 := tdp.Type{
		Name: "storyViewPublicRepost",
		ID:   StoryViewPublicRepostTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Blocked",
			SchemaName: "blocked",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "BlockedMyStoriesFrom",
			SchemaName: "blocked_my_stories_from",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "PeerID",
			SchemaName: "peer_id",
		},
		{
			Name:       "Story",
			SchemaName: "story",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StoryViewPublicRepost) () {
	if !(.Blocked == false) {
		.Flags.Set(0)
	}
	if !(.BlockedMyStoriesFrom == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *StoryViewPublicRepost) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyViewPublicRepost#bd74cf49 as nil")
	}
	.PutID(StoryViewPublicRepostTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StoryViewPublicRepost) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode storyViewPublicRepost#bd74cf49 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field flags: %w", )
	}
	if .PeerID == nil {
		return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field peer_id is nil")
	}
	if  := .PeerID.Encode();  != nil {
		return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field peer_id: %w", )
	}
	if .Story == nil {
		return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field story is nil")
	}
	if  := .Story.Encode();  != nil {
		return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field story: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StoryViewPublicRepost) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode storyViewPublicRepost#bd74cf49 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field flags: %w", )
		}
	}
	.Blocked = .Flags.Has(0)
	.BlockedMyStoriesFrom = .Flags.Has(1)
	{
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field peer_id: %w", )
		}
		.PeerID = 
	}
	{
		,  := DecodeStoryItem()
		if  != nil {
			return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field story: %w", )
		}
		.Story = 
	}
	return nil
}

// SetBlocked sets value of Blocked conditional field.
func ( *StoryViewPublicRepost) ( bool) {
	if  {
		.Flags.Set(0)
		.Blocked = true
	} else {
		.Flags.Unset(0)
		.Blocked = false
	}
}

// GetBlocked returns value of Blocked conditional field.
func ( *StoryViewPublicRepost) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field.
func ( *StoryViewPublicRepost) ( bool) {
	if  {
		.Flags.Set(1)
		.BlockedMyStoriesFrom = true
	} else {
		.Flags.Unset(1)
		.BlockedMyStoriesFrom = false
	}
}

// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field.
func ( *StoryViewPublicRepost) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// GetPeerID returns value of PeerID field.
func ( *StoryViewPublicRepost) () ( PeerClass) {
	if  == nil {
		return
	}
	return .PeerID
}

// GetStory returns value of Story field.
func ( *StoryViewPublicRepost) () ( StoryItemClass) {
	if  == nil {
		return
	}
	return .Story
}

// StoryViewClassName is schema name of StoryViewClass.
const StoryViewClassName = "StoryView"

// StoryViewClass represents StoryView generic type.
//
// See https://core.telegram.org/type/StoryView for reference.
//
// Example:
//
//	g, err := tg.DecodeStoryView(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.StoryView: // storyView#b0bdeac5
//	case *tg.StoryViewPublicForward: // storyViewPublicForward#9083670b
//	case *tg.StoryViewPublicRepost: // storyViewPublicRepost#bd74cf49
//	default: panic(v)
//	}
type StoryViewClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() StoryViewClass

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

	// Whether we have completely blocked¹ this user, including from viewing more of our
	// stories.
	//
	// Links:
	//  1) https://core.telegram.org/api/block
	GetBlocked() (value bool)

	// Whether we have blocked¹ this user from viewing more of our stories.
	//
	// Links:
	//  1) https://core.telegram.org/api/block
	GetBlockedMyStoriesFrom() (value bool)
}

// DecodeStoryView implements binary de-serialization for StoryViewClass.
func ( *bin.Buffer) (StoryViewClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case StoryViewTypeID:
		// Decoding storyView#b0bdeac5.
		 := StoryView{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode StoryViewClass: %w", )
		}
		return &, nil
	case StoryViewPublicForwardTypeID:
		// Decoding storyViewPublicForward#9083670b.
		 := StoryViewPublicForward{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode StoryViewClass: %w", )
		}
		return &, nil
	case StoryViewPublicRepostTypeID:
		// Decoding storyViewPublicRepost#bd74cf49.
		 := StoryViewPublicRepost{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode StoryViewClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode StoryViewClass: %w", bin.NewUnexpectedID())
	}
}

// StoryView boxes the StoryViewClass providing a helper.
type StoryViewBox struct {
	StoryView StoryViewClass
}

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

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