from telethon.tl.mtproto_request import MTProtoRequest


class Password(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password"""

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

    def __init__(self, current_salt, new_salt, hint, has_recovery, email_unconfirmed_pattern):
        """
        :param current_salt: Telegram type: «bytes».
        :param new_salt: Telegram type: «bytes».
        :param hint: Telegram type: «string».
        :param has_recovery: Telegram type: «Bool».
        :param email_unconfirmed_pattern: Telegram type: «string».
        """
        super().__init__()

        self.current_salt = current_salt
        self.new_salt = new_salt
        self.hint = hint
        self.has_recovery = has_recovery
        self.email_unconfirmed_pattern = email_unconfirmed_pattern

    def on_send(self, writer):
        writer.write_int(Password.constructor_id, signed=False)
        writer.tgwrite_bytes(self.current_salt)
        writer.tgwrite_bytes(self.new_salt)
        writer.tgwrite_string(self.hint)
        writer.tgwrite_bool(self.has_recovery)
        writer.tgwrite_string(self.email_unconfirmed_pattern)

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

    def on_response(self, reader):
        self.current_salt = reader.tgread_bytes()
        self.new_salt = reader.tgread_bytes()
        self.hint = reader.tgread_string()
        self.has_recovery = reader.tgread_bool()
        self.email_unconfirmed_pattern = reader.tgread_string()

    def __repr__(self):
        return 'account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password'

    def __str__(self):
        return '(account.password (ID: 0x7c18141c) = (current_salt={}, new_salt={}, hint={}, has_recovery={}, email_unconfirmed_pattern={}))'.format(str(self.current_salt), str(self.new_salt), str(self.hint), str(self.has_recovery), str(self.email_unconfirmed_pattern))
