from ...tl.mtproto_request import MTProtoRequest


class UserStatusOffline(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    userStatusOffline#008c703f was_online:date = UserStatus"""

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

    def __init__(self, was_online):
        """
        :param was_online: Telegram type: «date».

        Constructor for UserStatus: Instance of either UserStatusEmpty, UserStatusOnline, UserStatusOffline, UserStatusRecently, UserStatusLastWeek, UserStatusLastMonth.
        """
        super().__init__()

        self.was_online = was_online

    def on_send(self, writer):
        writer.write_int(UserStatusOffline.constructor_id, signed=False)
        writer.tgwrite_date(self.was_online)

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

    def on_response(self, reader):
        self.was_online = reader.tgread_date()

    def __repr__(self):
        return 'userStatusOffline#008c703f was_online:date = UserStatus'

    def __str__(self):
        return '(userStatusOffline (ID: 0x8c703f) = (was_online={}))'.format(str(self.was_online))
