from ....tl.mtproto_request import MTProtoRequest


class GetNotifySettingsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings"""

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

    def __init__(self, peer):
        """
        :param peer: Telegram type: "InputNotifyPeer".

        :returns PeerNotifySettings: Instance of either PeerNotifySettingsEmpty, PeerNotifySettings.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.peer = peer

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

    def on_send(self, writer):
        writer.write_int(GetNotifySettingsRequest.constructor_id, signed=False)
        self.peer.on_send(writer)

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

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

    def __repr__(self):
        return 'account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings'

    def __str__(self):
        return '(account.getNotifySettings (ID: 0x12b3ad31) = (peer={}))'.format(str(self.peer))
