from ...tl.tlobject import TLObject


class PageBlockParagraph(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    pageBlockParagraph#467a0766 text:RichText = PageBlock"""

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

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

        Constructor for PageBlock: Instance of either PageBlockUnsupported, PageBlockTitle, PageBlockSubtitle, PageBlockAuthorDate, PageBlockHeader, PageBlockSubheader, PageBlockParagraph, PageBlockPreformatted, PageBlockFooter, PageBlockDivider, PageBlockAnchor, PageBlockList, PageBlockBlockquote, PageBlockPullquote, PageBlockPhoto, PageBlockVideo, PageBlockCover, PageBlockEmbed, PageBlockEmbedPost, PageBlockCollage, PageBlockSlideshow, PageBlockChannel, PageBlockAudio.
        """
        super().__init__()

        self.text = text

    def to_dict(self):
        return {
            'text': None if self.text is None else self.text.to_dict(),
        }

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

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

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

    def __repr__(self):
        return 'pageBlockParagraph#467a0766 text:RichText = PageBlock'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
