from ...tl.tlobject import TLObject


class InputBotInlineMessageMediaVenue(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xaaafadc8
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x53fb4010

    def __init__(self, geo_point, title, address, provider, venue_id, reply_markup=None):
        """
        :param geo_point: Telegram type: "InputGeoPoint".
        :param title: Telegram type: "string".
        :param address: Telegram type: "string".
        :param provider: Telegram type: "string".
        :param venue_id: Telegram type: "string".
        :param reply_markup: Telegram type: "ReplyMarkup".

        Constructor for InputBotInlineMessage: Instance of either InputBotInlineMessageMediaAuto, InputBotInlineMessageText, InputBotInlineMessageMediaGeo, InputBotInlineMessageMediaVenue, InputBotInlineMessageMediaContact, InputBotInlineMessageGame.
        """
        super().__init__()

        self.geo_point = geo_point
        self.title = title
        self.address = address
        self.provider = provider
        self.venue_id = venue_id
        self.reply_markup = reply_markup

    def to_dict(self):
        return {
            'geo_point': None if self.geo_point is None else self.geo_point.to_dict(),
            'title': self.title,
            'address': self.address,
            'provider': self.provider,
            'venue_id': self.venue_id,
            'reply_markup': None if self.reply_markup is None else self.reply_markup.to_dict(),
        }

    def on_send(self, writer):
        writer.write_int(InputBotInlineMessageMediaVenue.constructor_id, signed=False)
        # Calculate the flags. This equals to those flag arguments which are NOT None
        flags = 0
        flags |= (1 << 2) if self.reply_markup else 0
        writer.write_int(flags)

        self.geo_point.on_send(writer)
        writer.tgwrite_string(self.title)
        writer.tgwrite_string(self.address)
        writer.tgwrite_string(self.provider)
        writer.tgwrite_string(self.venue_id)
        if self.reply_markup:
            self.reply_markup.on_send(writer)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return InputBotInlineMessageMediaVenue(None, None, None, None, None, None)

    def on_response(self, reader):
        flags = reader.read_int()

        self.geo_point = reader.tgread_object()
        self.title = reader.tgread_string()
        self.address = reader.tgread_string()
        self.provider = reader.tgread_string()
        self.venue_id = reader.tgread_string()
        if (flags & (1 << 2)) != 0:
            self.reply_markup = reader.tgread_object()

    def __repr__(self):
        return 'inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
