from ...tl.mtproto_request import MTProtoRequest


class TextUnderline(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    textUnderline#c12622c4 text:RichText = RichText"""

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

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

        Constructor for RichText: Instance of either TextEmpty, TextPlain, TextBold, TextItalic, TextUnderline, TextStrike, TextFixed, TextUrl, TextEmail, TextConcat.
        """
        super().__init__()

        self.text = text

    def on_send(self, writer):
        writer.write_int(TextUnderline.constructor_id, signed=False)
        self.text.on_send(writer)

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

    def on_response(self, reader):
        self.text = reader.tgread_object()

    def __repr__(self):
        return 'textUnderline#c12622c4 text:RichText = RichText'

    def __str__(self):
        return '(textUnderline (ID: 0xc12622c4) = (text={}))'.format(str(self.text))
