from ....tl.mtproto_request import MTProtoRequest


class CheckPhoneRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone"""

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

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

        :returns auth.CheckedPhone: Instance of CheckedPhone.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.phone_number = phone_number

    def on_send(self, writer):
        writer.write_int(CheckPhoneRequest.constructor_id, signed=False)
        writer.tgwrite_string(self.phone_number)

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

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone'

    def __str__(self):
        return '(auth.checkPhone (ID: 0x6fe51dfb) = (phone_number={}))'.format(str(self.phone_number))
