from ...tl.mtproto_request import MTProtoRequest


class MessageActionPaymentSent(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction"""

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

    def __init__(self, currency, total_amount):
        """
        :param currency: Telegram type: «string».
        :param total_amount: Telegram type: «long».

        Constructor for MessageAction: Instance of either MessageActionEmpty, MessageActionChatCreate, MessageActionChatEditTitle, MessageActionChatEditPhoto, MessageActionChatDeletePhoto, MessageActionChatAddUser, MessageActionChatDeleteUser, MessageActionChatJoinedByLink, MessageActionChannelCreate, MessageActionChatMigrateTo, MessageActionChannelMigrateFrom, MessageActionPinMessage, MessageActionHistoryClear, MessageActionGameScore, MessageActionPaymentSentMe, MessageActionPaymentSent, MessageActionPhoneCall.
        """
        super().__init__()

        self.currency = currency
        self.total_amount = total_amount

    def on_send(self, writer):
        writer.write_int(MessageActionPaymentSent.constructor_id, signed=False)
        writer.tgwrite_string(self.currency)
        writer.write_long(self.total_amount)

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

    def on_response(self, reader):
        self.currency = reader.tgread_string()
        self.total_amount = reader.read_long()

    def __repr__(self):
        return 'messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction'

    def __str__(self):
        return '(messageActionPaymentSent (ID: 0x40699cd0) = (currency={}, total_amount={}))'.format(str(self.currency), str(self.total_amount))
