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

// MessagesGetMessageReadParticipantsRequest represents TL type `messages.getMessageReadParticipants#31c1c44f`.
// Get which users read a specific message: only available for groups and supergroups
// with less than chat_read_mark_size_threshold members¹, read receipts will be stored
// for chat_read_mark_expire_period seconds after the message was sent², see client
// configuration for more info »³.
//
// Links:
//  1. https://core.telegram.org/api/config#chat-read-mark-size-threshold
//  2. https://core.telegram.org/api/config#chat-read-mark-expire-period
//  3. https://core.telegram.org/api/config#client-configuration
//
// See https://core.telegram.org/method/messages.getMessageReadParticipants for reference.
type MessagesGetMessageReadParticipantsRequest struct {
	// Dialog
	Peer InputPeerClass
	// Message ID
	MsgID int
}

// MessagesGetMessageReadParticipantsRequestTypeID is TL type id of MessagesGetMessageReadParticipantsRequest.
const MessagesGetMessageReadParticipantsRequestTypeID = 0x31c1c44f

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

func ( *MessagesGetMessageReadParticipantsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetMessageReadParticipantsRequest from given interface.
func ( *MessagesGetMessageReadParticipantsRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.MsgID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetMessageReadParticipantsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getMessageReadParticipants",
		ID:   MessagesGetMessageReadParticipantsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetMessageReadParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageReadParticipants#31c1c44f as nil")
	}
	.PutID(MessagesGetMessageReadParticipantsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetMessageReadParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageReadParticipants#31c1c44f as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getMessageReadParticipants#31c1c44f: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getMessageReadParticipants#31c1c44f: field peer: %w", )
	}
	.PutInt(.MsgID)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetMessageReadParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessageReadParticipants#31c1c44f to nil")
	}
	if  := .ConsumeID(MessagesGetMessageReadParticipantsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getMessageReadParticipants#31c1c44f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetMessageReadParticipantsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessageReadParticipants#31c1c44f to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReadParticipants#31c1c44f: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReadParticipants#31c1c44f: field msg_id: %w", )
		}
		.MsgID = 
	}
	return nil
}

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

// GetMsgID returns value of MsgID field.
func ( *MessagesGetMessageReadParticipantsRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// MessagesGetMessageReadParticipants invokes method messages.getMessageReadParticipants#31c1c44f returning error if any.
// Get which users read a specific message: only available for groups and supergroups
// with less than chat_read_mark_size_threshold members¹, read receipts will be stored
// for chat_read_mark_expire_period seconds after the message was sent², see client
// configuration for more info »³.
//
// Links:
//  1. https://core.telegram.org/api/config#chat-read-mark-size-threshold
//  2. https://core.telegram.org/api/config#chat-read-mark-expire-period
//  3. https://core.telegram.org/api/config#client-configuration
//
// Possible errors:
//
//	400 CHAT_TOO_BIG: This method is not available for groups with more than chat_read_mark_size_threshold members, see client configuration ».
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 MSG_TOO_OLD: chat_read_mark_expire_period seconds have passed since the message was sent, read receipts were deleted.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getMessageReadParticipants for reference.
func ( *Client) ( context.Context,  *MessagesGetMessageReadParticipantsRequest) ([]ReadParticipantDate, error) {
	var  ReadParticipantDateVector

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