from ..base import AdyenServiceBase


class PaymentsAppApi(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().__init__(client=client)
        self.service = "paymentsApp"
        self.baseUrl = "https://management-live.adyen.com/v1"

    def generate_payments_app_boarding_token_for_merchant(
        self, request, merchantId, idempotency_key=None, **kwargs
    ):
        """
        Create a boarding token - merchant level
        """
        endpoint = self.baseUrl + f"/merchants/{merchantId}/generatePaymentsAppBoardingToken"
        method = "POST"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def generate_payments_app_boarding_token_for_store(
        self, request, merchantId, storeId, idempotency_key=None, **kwargs
    ):
        """
        Create a boarding token - store level
        """
        endpoint = (
            self.baseUrl
            + f"/merchants/{merchantId}/stores/{storeId}/generatePaymentsAppBoardingToken"
        )
        method = "POST"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def list_payments_app_for_merchant(self, merchantId, idempotency_key=None, **kwargs):
        """
        Get a list of Payments Apps - merchant level
        """
        endpoint = self.baseUrl + f"/merchants/{merchantId}/paymentsApps"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def list_payments_app_for_store(self, merchantId, storeId, idempotency_key=None, **kwargs):
        """
        Get a list of Payments Apps - store level
        """
        endpoint = self.baseUrl + f"/merchants/{merchantId}/stores/{storeId}/paymentsApps"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def revoke_payments_app(self, merchantId, installationId, idempotency_key=None, **kwargs):
        """
        Revoke Payments App instance authentication
        """
        endpoint = self.baseUrl + f"/merchants/{merchantId}/paymentsApps/{installationId}/revoke"
        method = "POST"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )
