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

// StoriesGetStoryReactionsListRequest represents TL type `stories.getStoryReactionsList#b9b2881f`.
//
// See https://core.telegram.org/method/stories.getStoryReactionsList for reference.
type StoriesGetStoryReactionsListRequest struct {
	// Flags field of StoriesGetStoryReactionsListRequest.
	Flags bin.Fields
	// ForwardsFirst field of StoriesGetStoryReactionsListRequest.
	ForwardsFirst bool
	// Peer field of StoriesGetStoryReactionsListRequest.
	Peer InputPeerClass
	// ID field of StoriesGetStoryReactionsListRequest.
	ID int
	// Reaction field of StoriesGetStoryReactionsListRequest.
	//
	// Use SetReaction and GetReaction helpers.
	Reaction ReactionClass
	// Offset field of StoriesGetStoryReactionsListRequest.
	//
	// Use SetOffset and GetOffset helpers.
	Offset string
	// Limit field of StoriesGetStoryReactionsListRequest.
	Limit int
}

// StoriesGetStoryReactionsListRequestTypeID is TL type id of StoriesGetStoryReactionsListRequest.
const StoriesGetStoryReactionsListRequestTypeID = 0xb9b2881f

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

func ( *StoriesGetStoryReactionsListRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ForwardsFirst == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == 0) {
		return false
	}
	if !(.Reaction == nil) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StoriesGetStoryReactionsListRequest from given interface.
func ( *StoriesGetStoryReactionsListRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( int)
	() ( ReactionClass,  bool)
	() ( string,  bool)
	() ( int)
}) {
	.ForwardsFirst = .()
	.Peer = .()
	.ID = .()
	if ,  := .();  {
		.Reaction = 
	}

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

	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*StoriesGetStoryReactionsListRequest) () string {
	return "stories.getStoryReactionsList"
}

// TypeInfo returns info about TL type.
func ( *StoriesGetStoryReactionsListRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stories.getStoryReactionsList",
		ID:   StoriesGetStoryReactionsListRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ForwardsFirst",
			SchemaName: "forwards_first",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Reaction",
			SchemaName: "reaction",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StoriesGetStoryReactionsListRequest) () {
	if !(.ForwardsFirst == false) {
		.Flags.Set(2)
	}
	if !(.Reaction == nil) {
		.Flags.Set(0)
	}
	if !(.Offset == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *StoriesGetStoryReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.getStoryReactionsList#b9b2881f as nil")
	}
	.PutID(StoriesGetStoryReactionsListRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StoriesGetStoryReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.getStoryReactionsList#b9b2881f as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field peer: %w", )
	}
	.PutInt(.ID)
	if .Flags.Has(0) {
		if .Reaction == nil {
			return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field reaction is nil")
		}
		if  := .Reaction.Encode();  != nil {
			return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field reaction: %w", )
		}
	}
	if .Flags.Has(1) {
		.PutString(.Offset)
	}
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StoriesGetStoryReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stories.getStoryReactionsList#b9b2881f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field flags: %w", )
		}
	}
	.ForwardsFirst = .Flags.Has(2)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := DecodeReaction()
		if  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field reaction: %w", )
		}
		.Reaction = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetForwardsFirst sets value of ForwardsFirst conditional field.
func ( *StoriesGetStoryReactionsListRequest) ( bool) {
	if  {
		.Flags.Set(2)
		.ForwardsFirst = true
	} else {
		.Flags.Unset(2)
		.ForwardsFirst = false
	}
}

// GetForwardsFirst returns value of ForwardsFirst conditional field.
func ( *StoriesGetStoryReactionsListRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// GetPeer returns value of Peer field.
func ( *StoriesGetStoryReactionsListRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetID returns value of ID field.
func ( *StoriesGetStoryReactionsListRequest) () ( int) {
	if  == nil {
		return
	}
	return .ID
}

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

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

// SetOffset sets value of Offset conditional field.
func ( *StoriesGetStoryReactionsListRequest) ( string) {
	.Flags.Set(1)
	.Offset = 
}

// GetOffset returns value of Offset conditional field and
// boolean which is true if field was set.
func ( *StoriesGetStoryReactionsListRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .Offset, true
}

// GetLimit returns value of Limit field.
func ( *StoriesGetStoryReactionsListRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// StoriesGetStoryReactionsList invokes method stories.getStoryReactionsList#b9b2881f returning error if any.
//
// See https://core.telegram.org/method/stories.getStoryReactionsList for reference.
func ( *Client) ( context.Context,  *StoriesGetStoryReactionsListRequest) (*StoriesStoryReactionsList, error) {
	var  StoriesStoryReactionsList

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}