from ....tl.mtproto_request import MTProtoRequest


class ClearSavedInfoRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool"""

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

    def __init__(self, credentials=None, info=None):
        """
        :param credentials: Telegram type: «true».
        :param info: Telegram type: «true».

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

        self.credentials = credentials
        self.info = info

    def on_send(self, writer):
        writer.write_int(ClearSavedInfoRequest.constructor_id, signed=False)
        # Calculate the flags. This equals to those flag arguments which are NOT None
        flags = 0
        flags |= (1 << 0) if self.credentials else 0
        flags |= (1 << 1) if self.info else 0
        writer.write_int(flags)


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

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

    def __repr__(self):
        return 'payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool'

    def __str__(self):
        return '(payments.clearSavedInfo (ID: 0xd83d70c1) = (credentials={}, info={}))'.format(str(self.credentials), str(self.info))
