from ...tl.mtproto_request import MTProtoRequest


class DataJSON(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    dataJSON#7d748d04 data:string = DataJSON"""

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

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

        Constructor for DataJSON: Instance of DataJSON.
        """
        super().__init__()

        self.data = data

    def on_send(self, writer):
        writer.write_int(DataJSON.constructor_id, signed=False)
        writer.tgwrite_string(self.data)

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

    def on_response(self, reader):
        self.data = reader.tgread_string()

    def __repr__(self):
        return 'dataJSON#7d748d04 data:string = DataJSON'

    def __str__(self):
        return '(dataJSON (ID: 0x7d748d04) = (data={}))'.format(str(self.data))
