from ....tl.mtproto_request import MTProtoRequest


class PaymentResult(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0x4e5f810d

    def __init__(self, updates):
        """
        :param updates: Telegram type: «Updates».

        Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerficationNeeded.
        """
        super().__init__()

        self.updates = updates

    def on_send(self, writer):
        writer.write_int(PaymentResult.constructor_id, signed=False)
        self.updates.on_send(writer)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return PaymentResult(None)

    def on_response(self, reader):
        self.updates = reader.tgread_object()

    def __repr__(self):
        return 'payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult'

    def __str__(self):
        return '(payments.paymentResult (ID: 0x4e5f810d) = (updates={}))'.format(str(self.updates))
