from ..base import AdyenServiceBase


class PaymentInstrumentsApi(AdyenServiceBase):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, client=None):
        super(PaymentInstrumentsApi, self).__init__(client=client)
        self.service = "balancePlatform"
        self.baseUrl = "https://balanceplatform-api-test.adyen.com/bcl/v2"

    def create_network_token_provisioning_data(self, request, id, idempotency_key=None, **kwargs):
        """
        Create network token provisioning data
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}/networkTokenActivationData"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def create_payment_instrument(self, request, idempotency_key=None, **kwargs):
        """
        Create a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def get_all_transaction_rules_for_payment_instrument(self, id, idempotency_key=None, **kwargs):
        """
        Get all transaction rules for a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}/transactionRules"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def get_network_token_activation_data(self, id, idempotency_key=None, **kwargs):
        """
        Get network token activation data
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}/networkTokenActivationData"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def get_pan_of_payment_instrument(self, id, idempotency_key=None, **kwargs):
        """
        Get the PAN of a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}/reveal"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def get_payment_instrument(self, id, idempotency_key=None, **kwargs):
        """
        Get a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def list_network_tokens(self, id, idempotency_key=None, **kwargs):
        """
        List network tokens
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}/networkTokens"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def reveal_data_of_payment_instrument(self, request, idempotency_key=None, **kwargs):
        """
        Reveal the data of a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments/reveal"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def update_payment_instrument(self, request, id, idempotency_key=None, **kwargs):
        """
        Update a payment instrument
        """
        endpoint = self.baseUrl + f"/paymentInstruments/{id}"
        method = "PATCH"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

