from ...tl.mtproto_request import MTProtoRequest


class InputPhoneContact(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact"""

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

    def __init__(self, client_id, phone, first_name, last_name):
        """
        :param client_id: Telegram type: «long».
        :param phone: Telegram type: «string».
        :param first_name: Telegram type: «string».
        :param last_name: Telegram type: «string».

        Constructor for InputContact: Instance of InputPhoneContact.
        """
        super().__init__()

        self.client_id = client_id
        self.phone = phone
        self.first_name = first_name
        self.last_name = last_name

    def on_send(self, writer):
        writer.write_int(InputPhoneContact.constructor_id, signed=False)
        writer.write_long(self.client_id)
        writer.tgwrite_string(self.phone)
        writer.tgwrite_string(self.first_name)
        writer.tgwrite_string(self.last_name)

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

    def on_response(self, reader):
        self.client_id = reader.read_long()
        self.phone = reader.tgread_string()
        self.first_name = reader.tgread_string()
        self.last_name = reader.tgread_string()

    def __repr__(self):
        return 'inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact'

    def __str__(self):
        return '(inputPhoneContact (ID: 0xf392b7f4) = (client_id={}, phone={}, first_name={}, last_name={}))'.format(str(self.client_id), str(self.phone), str(self.first_name), str(self.last_name))
