from ...tl.mtproto_request import MTProtoRequest


class InputPaymentCredentialsSaved(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials"""

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

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

        Constructor for InputPaymentCredentials: Instance of either InputPaymentCredentialsSaved, InputPaymentCredentials.
        """
        super().__init__()

        self.id = id
        self.tmp_password = tmp_password

    def on_send(self, writer):
        writer.write_int(InputPaymentCredentialsSaved.constructor_id, signed=False)
        writer.tgwrite_string(self.id)
        writer.tgwrite_bytes(self.tmp_password)

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

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

    def __repr__(self):
        return 'inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials'

    def __str__(self):
        return '(inputPaymentCredentialsSaved (ID: 0xc10eb2cf) = (id={}, tmp_password={}))'.format(str(self.id), str(self.tmp_password))
