from ....tl.mtproto_request import MTProtoRequest


class SetAccountTTLRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool"""

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

    def __init__(self, ttl):
        """
        :param ttl: Telegram type: "AccountDaysTTL".

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.ttl = ttl

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

    def on_send(self, writer):
        writer.write_int(SetAccountTTLRequest.constructor_id, signed=False)
        self.ttl.on_send(writer)

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

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

    def __repr__(self):
        return 'account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool'

    def __str__(self):
        return '(account.setAccountTTL (ID: 0x2442485e) = (ttl={}))'.format(str(self.ttl))
