from telethon.tl.mtproto_request import MTProtoRequest


class SentEncryptedFile(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.sentEncryptedFile#9493ff32 date:date file:EncryptedFile = messages.SentEncryptedMessage"""

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

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

        self.date = date
        self.file = file

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

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

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

    def __repr__(self):
        return 'messages.sentEncryptedFile#9493ff32 date:date file:EncryptedFile = messages.SentEncryptedMessage'

    def __str__(self):
        return '(messages.sentEncryptedFile (ID: 0x9493ff32) = (date={}, file={}))'.format(str(self.date), str(self.file))
