from ...tl.mtproto_request import MTProtoRequest


class PaymentSavedCredentialsCard(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials"""

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

    def __init__(self, id, title):
        """
        :param id: Telegram type: «string».
        :param title: Telegram type: «string».

        Constructor for PaymentSavedCredentials: Instance of PaymentSavedCredentialsCard.
        """
        super().__init__()

        self.id = id
        self.title = title

    def on_send(self, writer):
        writer.write_int(PaymentSavedCredentialsCard.constructor_id, signed=False)
        writer.tgwrite_string(self.id)
        writer.tgwrite_string(self.title)

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

    def on_response(self, reader):
        self.id = reader.tgread_string()
        self.title = reader.tgread_string()

    def __repr__(self):
        return 'paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials'

    def __str__(self):
        return '(paymentSavedCredentialsCard (ID: 0xcdc27a1f) = (id={}, title={}))'.format(str(self.id), str(self.title))
