from telethon.tl.mtproto_request import MTProtoRequest


class MessageMediaVenue(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia"""

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

    def __init__(self, geo, title, address, provider, venue_id):
        """
        :param geo: Telegram type: «GeoPoint».
        :param title: Telegram type: «string».
        :param address: Telegram type: «string».
        :param provider: Telegram type: «string».
        :param venue_id: Telegram type: «string».
        """
        super().__init__()

        self.geo = geo
        self.title = title
        self.address = address
        self.provider = provider
        self.venue_id = venue_id

    def on_send(self, writer):
        writer.write_int(MessageMediaVenue.constructor_id, signed=False)
        self.geo.on_send(writer)
        writer.tgwrite_string(self.title)
        writer.tgwrite_string(self.address)
        writer.tgwrite_string(self.provider)
        writer.tgwrite_string(self.venue_id)

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

    def on_response(self, reader):
        self.geo = reader.tgread_object()
        self.title = reader.tgread_string()
        self.address = reader.tgread_string()
        self.provider = reader.tgread_string()
        self.venue_id = reader.tgread_string()

    def __repr__(self):
        return 'messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia'

    def __str__(self):
        return '(messageMediaVenue (ID: 0x7912b71f) = (geo={}, title={}, address={}, provider={}, venue_id={}))'.format(str(self.geo), str(self.title), str(self.address), str(self.provider), str(self.venue_id))
