from ....tl.mtproto_request import MTProtoRequest


class SearchGifsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs"""

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

    def __init__(self, q, offset):
        """
        :param q: Telegram type: «string».
        :param offset: Telegram type: «int».

        :returns messages.FoundGifs: Instance of FoundGifs.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.q = q
        self.offset = offset

    def on_send(self, writer):
        writer.write_int(SearchGifsRequest.constructor_id, signed=False)
        writer.tgwrite_string(self.q)
        writer.write_int(self.offset)

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

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs'

    def __str__(self):
        return '(messages.searchGifs (ID: 0xbf9a776b) = (q={}, offset={}))'.format(str(self.q), str(self.offset))
