from ....tl.tlobject import TLObject


class Support(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    help.support#17c6b5f6 phone_number:string user:User = help.Support"""

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

    def __init__(self, phone_number, user):
        """
        :param phone_number: Telegram type: "string".
        :param user: Telegram type: "User".

        Constructor for help.Support: Instance of Support.
        """
        super().__init__()

        self.phone_number = phone_number
        self.user = user

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

    def on_send(self, writer):
        writer.write_int(Support.constructor_id, signed=False)
        writer.tgwrite_string(self.phone_number)
        self.user.on_send(writer)

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

    def on_response(self, reader):
        self.phone_number = reader.tgread_string()
        self.user = reader.tgread_object()

    def __repr__(self):
        return 'help.support#17c6b5f6 phone_number:string user:User = help.Support'

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

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