from ...tl.mtproto_request import MTProtoRequest


class MessageMediaContact(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia"""

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

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

        Constructor for MessageMedia: Instance of either MessageMediaEmpty, MessageMediaPhoto, MessageMediaGeo, MessageMediaContact, MessageMediaUnsupported, MessageMediaDocument, MessageMediaWebPage, MessageMediaVenue, MessageMediaGame, MessageMediaInvoice.
        """
        super().__init__()

        self.phone_number = phone_number
        self.first_name = first_name
        self.last_name = last_name
        self.user_id = user_id

    def on_send(self, writer):
        writer.write_int(MessageMediaContact.constructor_id, signed=False)
        writer.tgwrite_string(self.phone_number)
        writer.tgwrite_string(self.first_name)
        writer.tgwrite_string(self.last_name)
        writer.write_int(self.user_id)

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

    def on_response(self, reader):
        self.phone_number = reader.tgread_string()
        self.first_name = reader.tgread_string()
        self.last_name = reader.tgread_string()
        self.user_id = reader.read_int()

    def __repr__(self):
        return 'messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia'

    def __str__(self):
        return '(messageMediaContact (ID: 0x5e7d2f39) = (phone_number={}, first_name={}, last_name={}, user_id={}))'.format(str(self.phone_number), str(self.first_name), str(self.last_name), str(self.user_id))
