from ....tl.tlobject import TLObject


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

    # Telegram's constructor (U)ID for this class
    constructor_id = 0x4e5f810d
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x8ae16a9d

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

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

        self.updates = updates

    def to_dict(self):
        return {
            'updates': None if self.updates is None else self.updates.to_dict(),
        }

    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 (attributes=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 TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
