from ...tl.mtproto_request import MTProtoRequest


class PaymentCharge(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge"""

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

    def __init__(self, id, provider_charge_id):
        """
        :param id: Telegram type: «string».
        :param provider_charge_id: Telegram type: «string».

        Constructor for PaymentCharge: Instance of PaymentCharge.
        """
        super().__init__()

        self.id = id
        self.provider_charge_id = provider_charge_id

    def on_send(self, writer):
        writer.write_int(PaymentCharge.constructor_id, signed=False)
        writer.tgwrite_string(self.id)
        writer.tgwrite_string(self.provider_charge_id)

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

    def on_response(self, reader):
        self.id = reader.tgread_string()
        self.provider_charge_id = reader.tgread_string()

    def __repr__(self):
        return 'paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge'

    def __str__(self):
        return '(paymentCharge (ID: 0xea02c27e) = (id={}, provider_charge_id={}))'.format(str(self.id), str(self.provider_charge_id))
