from ...tl.mtproto_request import MTProtoRequest


class SendMessageUploadRoundAction(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0x243e1c66
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x20b2cc21

    def __init__(self, progress):
        """
        :param progress: Telegram type: "int".

        Constructor for SendMessageAction: Instance of either SendMessageTypingAction, SendMessageCancelAction, SendMessageRecordVideoAction, SendMessageUploadVideoAction, SendMessageRecordAudioAction, SendMessageUploadAudioAction, SendMessageUploadPhotoAction, SendMessageUploadDocumentAction, SendMessageGeoLocationAction, SendMessageChooseContactAction, SendMessageGamePlayAction, SendMessageRecordRoundAction, SendMessageUploadRoundAction.
        """
        super().__init__()

        self.progress = progress

    def to_dict(self):
        return {
            'progress': self.progress,
        }

    def on_send(self, writer):
        writer.write_int(SendMessageUploadRoundAction.constructor_id, signed=False)
        writer.write_int(self.progress)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return SendMessageUploadRoundAction(None)

    def on_response(self, reader):
        self.progress = reader.read_int()

    def __repr__(self):
        return 'sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction'

    def __str__(self):
        return '(sendMessageUploadRoundAction (ID: 0x243e1c66) = (progress={}))'.format(str(self.progress))
