from ....tl.mtproto_request import MTProtoRequest


class CheckedPhone(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone"""

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

    def __init__(self, phone_registered):
        """
        :param phone_registered: Telegram type: «Bool».

        Constructor for auth.CheckedPhone: Instance of CheckedPhone.
        """
        super().__init__()

        self.phone_registered = phone_registered

    def on_send(self, writer):
        writer.write_int(CheckedPhone.constructor_id, signed=False)
        writer.tgwrite_bool(self.phone_registered)

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

    def on_response(self, reader):
        self.phone_registered = reader.tgread_bool()

    def __repr__(self):
        return 'auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone'

    def __str__(self):
        return '(auth.checkedPhone (ID: 0x811ea28e) = (phone_registered={}))'.format(str(self.phone_registered))
