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

// PaymentsGetPaymentReceiptRequest represents TL type `payments.getPaymentReceipt#2478d1cc`.
// Get payment receipt
//
// See https://core.telegram.org/method/payments.getPaymentReceipt for reference.
type PaymentsGetPaymentReceiptRequest struct {
	// The peer where the payment receipt was sent
	Peer InputPeerClass
	// Message ID of receipt
	MsgID int
}

// PaymentsGetPaymentReceiptRequestTypeID is TL type id of PaymentsGetPaymentReceiptRequest.
const PaymentsGetPaymentReceiptRequestTypeID = 0x2478d1cc

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*PaymentsGetPaymentReceiptRequest) () string {
	return "payments.getPaymentReceipt"
}

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

// Encode implements bin.Encoder.
func ( *PaymentsGetPaymentReceiptRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getPaymentReceipt#2478d1cc as nil")
	}
	.PutID(PaymentsGetPaymentReceiptRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *PaymentsGetPaymentReceiptRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getPaymentReceipt#2478d1cc to nil")
	}
	if  := .ConsumeID(PaymentsGetPaymentReceiptRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getPaymentReceipt#2478d1cc: %w", )
	}
	return .DecodeBare()
}

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

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

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

// PaymentsGetPaymentReceipt invokes method payments.getPaymentReceipt#2478d1cc returning error if any.
// Get payment receipt
//
// Possible errors:
//
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//
// See https://core.telegram.org/method/payments.getPaymentReceipt for reference.
func ( *Client) ( context.Context,  *PaymentsGetPaymentReceiptRequest) (*PaymentsPaymentReceipt, error) {
	var  PaymentsPaymentReceipt

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