from telethon.tl.mtproto_request import MTProtoRequest


class InputFile(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile"""

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

    def __init__(self, id, parts, name, md5_checksum):
        """
        :param id: Telegram type: «long».
        :param parts: Telegram type: «int».
        :param name: Telegram type: «string».
        :param md5_checksum: Telegram type: «string».
        """
        super().__init__()

        self.id = id
        self.parts = parts
        self.name = name
        self.md5_checksum = md5_checksum

    def on_send(self, writer):
        writer.write_int(InputFile.constructor_id, signed=False)
        writer.write_long(self.id)
        writer.write_int(self.parts)
        writer.tgwrite_string(self.name)
        writer.tgwrite_string(self.md5_checksum)

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

    def on_response(self, reader):
        self.id = reader.read_long()
        self.parts = reader.read_int()
        self.name = reader.tgread_string()
        self.md5_checksum = reader.tgread_string()

    def __repr__(self):
        return 'inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile'

    def __str__(self):
        return '(inputFile (ID: 0xf52ff27f) = (id={}, parts={}, name={}, md5_checksum={}))'.format(str(self.id), str(self.parts), str(self.name), str(self.md5_checksum))
