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

// MessagesGetUnreadReactionsRequest represents TL type `messages.getUnreadReactions#3223495b`.
// Get unread reactions to messages you sent
//
// See https://core.telegram.org/method/messages.getUnreadReactions for reference.
type MessagesGetUnreadReactionsRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Peer
	Peer InputPeerClass
	// If set, considers only reactions to messages within the specified forum topic¹
	//
	// Links:
	//  1) https://core.telegram.org/api/forum#forum-topics
	//
	// Use SetTopMsgID and GetTopMsgID helpers.
	TopMsgID int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	OffsetID int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	AddOffset int
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
	// Only return reactions for messages up until this message ID
	MaxID int
	// Only return reactions for messages starting from this message ID
	MinID int
}

// MessagesGetUnreadReactionsRequestTypeID is TL type id of MessagesGetUnreadReactionsRequest.
const MessagesGetUnreadReactionsRequestTypeID = 0x3223495b

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

func ( *MessagesGetUnreadReactionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.TopMsgID == 0) {
		return false
	}
	if !(.OffsetID == 0) {
		return false
	}
	if !(.AddOffset == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}
	if !(.MaxID == 0) {
		return false
	}
	if !(.MinID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetUnreadReactionsRequest from given interface.
func ( *MessagesGetUnreadReactionsRequest) ( interface {
	() ( InputPeerClass)
	() ( int,  bool)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
}) {
	.Peer = .()
	if ,  := .();  {
		.TopMsgID = 
	}

	.OffsetID = .()
	.AddOffset = .()
	.Limit = .()
	.MaxID = .()
	.MinID = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesGetUnreadReactionsRequest) () string {
	return "messages.getUnreadReactions"
}

// TypeInfo returns info about TL type.
func ( *MessagesGetUnreadReactionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getUnreadReactions",
		ID:   MessagesGetUnreadReactionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "TopMsgID",
			SchemaName: "top_msg_id",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "OffsetID",
			SchemaName: "offset_id",
		},
		{
			Name:       "AddOffset",
			SchemaName: "add_offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
		{
			Name:       "MaxID",
			SchemaName: "max_id",
		},
		{
			Name:       "MinID",
			SchemaName: "min_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesGetUnreadReactionsRequest) () {
	if !(.TopMsgID == 0) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesGetUnreadReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getUnreadReactions#3223495b as nil")
	}
	.PutID(MessagesGetUnreadReactionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetUnreadReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getUnreadReactions#3223495b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getUnreadReactions#3223495b: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getUnreadReactions#3223495b: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getUnreadReactions#3223495b: field peer: %w", )
	}
	if .Flags.Has(0) {
		.PutInt(.TopMsgID)
	}
	.PutInt(.OffsetID)
	.PutInt(.AddOffset)
	.PutInt(.Limit)
	.PutInt(.MaxID)
	.PutInt(.MinID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetUnreadReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getUnreadReactions#3223495b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field flags: %w", )
		}
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field peer: %w", )
		}
		.Peer = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field top_msg_id: %w", )
		}
		.TopMsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field offset_id: %w", )
		}
		.OffsetID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field add_offset: %w", )
		}
		.AddOffset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field limit: %w", )
		}
		.Limit = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field max_id: %w", )
		}
		.MaxID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getUnreadReactions#3223495b: field min_id: %w", )
		}
		.MinID = 
	}
	return nil
}

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

// SetTopMsgID sets value of TopMsgID conditional field.
func ( *MessagesGetUnreadReactionsRequest) ( int) {
	.Flags.Set(0)
	.TopMsgID = 
}

// GetTopMsgID returns value of TopMsgID conditional field and
// boolean which is true if field was set.
func ( *MessagesGetUnreadReactionsRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .TopMsgID, true
}

// GetOffsetID returns value of OffsetID field.
func ( *MessagesGetUnreadReactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .OffsetID
}

// GetAddOffset returns value of AddOffset field.
func ( *MessagesGetUnreadReactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .AddOffset
}

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

// GetMaxID returns value of MaxID field.
func ( *MessagesGetUnreadReactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .MaxID
}

// GetMinID returns value of MinID field.
func ( *MessagesGetUnreadReactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .MinID
}

// MessagesGetUnreadReactions invokes method messages.getUnreadReactions#3223495b returning error if any.
// Get unread reactions to messages you sent
//
// See https://core.telegram.org/method/messages.getUnreadReactions for reference.
func ( *Client) ( context.Context,  *MessagesGetUnreadReactionsRequest) (MessagesMessagesClass, error) {
	var  MessagesMessagesBox

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