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

// MessagesGetOutboxReadDateRequest represents TL type `messages.getOutboxReadDate#8c4bfe5d`.
// Get the exact read date of one of our messages, sent to a private chat with another
// user.
// Can be only done for private outgoing messages not older than appConfig
// pm_read_date_expire_period »¹.
// If the peer's userFull¹.read_dates_private flag is set, we will not be able to fetch
// the exact read date of messages we send to them, and a USER_PRIVACY_RESTRICTED RPC
// error will be emitted.
// The exact read date of messages might still be unavailable for other reasons, see here
// »² for more info.
// To set userFull³.read_dates_private for ourselves invoke account
// setGlobalPrivacySettings⁴, setting the settings.hide_read_marks flag.
//
// Links:
//  1. https://core.telegram.org/api/config#pm-read-date-expire-period
//  2. https://core.telegram.org/constructor/userFull
//  3. https://core.telegram.org/constructor/globalPrivacySettings
//  4. https://core.telegram.org/constructor/userFull
//  5. https://core.telegram.org/method/account.setGlobalPrivacySettings
//
// See https://core.telegram.org/method/messages.getOutboxReadDate for reference.
type MessagesGetOutboxReadDateRequest struct {
	// The user to whom we sent the message.
	Peer InputPeerClass
	// The message ID.
	MsgID int
}

// MessagesGetOutboxReadDateRequestTypeID is TL type id of MessagesGetOutboxReadDateRequest.
const MessagesGetOutboxReadDateRequestTypeID = 0x8c4bfe5d

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesGetOutboxReadDateRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getOutboxReadDate#8c4bfe5d as nil")
	}
	.PutID(MessagesGetOutboxReadDateRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *MessagesGetOutboxReadDateRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getOutboxReadDate#8c4bfe5d to nil")
	}
	if  := .ConsumeID(MessagesGetOutboxReadDateRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getOutboxReadDate#8c4bfe5d: %w", )
	}
	return .DecodeBare()
}

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

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

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

// MessagesGetOutboxReadDate invokes method messages.getOutboxReadDate#8c4bfe5d returning error if any.
// Get the exact read date of one of our messages, sent to a private chat with another
// user.
// Can be only done for private outgoing messages not older than appConfig
// pm_read_date_expire_period »¹.
// If the peer's userFull¹.read_dates_private flag is set, we will not be able to fetch
// the exact read date of messages we send to them, and a USER_PRIVACY_RESTRICTED RPC
// error will be emitted.
// The exact read date of messages might still be unavailable for other reasons, see here
// »² for more info.
// To set userFull³.read_dates_private for ourselves invoke account
// setGlobalPrivacySettings⁴, setting the settings.hide_read_marks flag.
//
// Links:
//  1. https://core.telegram.org/api/config#pm-read-date-expire-period
//  2. https://core.telegram.org/constructor/userFull
//  3. https://core.telegram.org/constructor/globalPrivacySettings
//  4. https://core.telegram.org/constructor/userFull
//  5. https://core.telegram.org/method/account.setGlobalPrivacySettings
//
// Possible errors:
//
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 MESSAGE_NOT_READ_YET: The specified message wasn't read yet.
//	400 MESSAGE_TOO_OLD: The message is too old, the requested information is not available.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this.
//	403 YOUR_PRIVACY_RESTRICTED: You cannot fetch the read date of this message because you have disallowed other users to do so for your messages; to fix, allow other users to see your exact last online date OR purchase a Telegram Premium subscription.
//
// See https://core.telegram.org/method/messages.getOutboxReadDate for reference.
func ( *Client) ( context.Context,  *MessagesGetOutboxReadDateRequest) (*OutboxReadDate, error) {
	var  OutboxReadDate

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