from ...tl.tlobject import TLObject


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

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

    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 to_dict(self):
        return {
            'id': self.id,
            'tmp_password': self.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 (attributes=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 TLObject.pretty_format(self)

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