from telethon.tl.mtproto_request import MTProtoRequest


class UpdateServiceNotification(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update"""

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

    def __init__(self, type, message, media, popup):
        """
        :param type: Telegram type: «string».
        :param message: Telegram type: «string».
        :param media: Telegram type: «MessageMedia».
        :param popup: Telegram type: «Bool».
        """
        super().__init__()

        self.type = type
        self.message = message
        self.media = media
        self.popup = popup

    def on_send(self, writer):
        writer.write_int(UpdateServiceNotification.constructor_id, signed=False)
        writer.tgwrite_string(self.type)
        writer.tgwrite_string(self.message)
        self.media.on_send(writer)
        writer.tgwrite_bool(self.popup)

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

    def on_response(self, reader):
        self.type = reader.tgread_string()
        self.message = reader.tgread_string()
        self.media = reader.tgread_object()
        self.popup = reader.tgread_bool()

    def __repr__(self):
        return 'updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update'

    def __str__(self):
        return '(updateServiceNotification (ID: 0x382dd3e4) = (type={}, message={}, media={}, popup={}))'.format(str(self.type), str(self.message), str(self.media), str(self.popup))
