from telethon.tl.mtproto_request import MTProtoRequest


class ReplyKeyboardHide(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    replyKeyboardHide#a03e5b85 flags:None selective:flags.2?true = ReplyMarkup"""

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

    def __init__(self, selective=None):
        """
        :param selective: Telegram type: «true».
        """
        super().__init__()

        self.selective = selective

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


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

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

        if (flags & (1 << 2)) != 0:
            self.selective = True  # Arbitrary not-None value, no need to read since it is a flag

    def __repr__(self):
        return 'replyKeyboardHide#a03e5b85 flags:None selective:flags.2?true = ReplyMarkup'

    def __str__(self):
        return '(replyKeyboardHide (ID: 0xa03e5b85) = (selective={}))'.format(str(self.selective))
