from ....tl.mtproto_request import MTProtoRequest


class SentEncryptedMessage(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.sentEncryptedMessage#560f8935 date:date = messages.SentEncryptedMessage"""

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

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

        Constructor for messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile.
        """
        super().__init__()

        self.date = date

    def on_send(self, writer):
        writer.write_int(SentEncryptedMessage.constructor_id, signed=False)
        writer.tgwrite_date(self.date)

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

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

    def __repr__(self):
        return 'messages.sentEncryptedMessage#560f8935 date:date = messages.SentEncryptedMessage'

    def __str__(self):
        return '(messages.sentEncryptedMessage (ID: 0x560f8935) = (date={}))'.format(str(self.date))
