from ..base import AdyenServiceBase


class DirectDebitMandatesApi(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 = "balancePlatform"
        self.baseUrl = "https://balanceplatform-api-test.adyen.com/bcl/v2"

    def cancel_mandate(self, mandateId, idempotency_key=None, **kwargs):
        """
        Cancel a mandate
        """
        endpoint = self.baseUrl + f"/mandates/{mandateId}/cancel"
        method = "POST"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def get_list_of_mandates(self, idempotency_key=None, **kwargs):
        """
        Get a list of mandates
        """
        endpoint = self.baseUrl + "/mandates"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def get_mandate_by_id(self, mandateId, idempotency_key=None, **kwargs):
        """
        Get a specific mandate
        """
        endpoint = self.baseUrl + f"/mandates/{mandateId}"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def update_mandate(self, request, mandateId, idempotency_key=None, **kwargs):
        """
        Amend a mandate
        """
        endpoint = self.baseUrl + f"/mandates/{mandateId}"
        method = "PATCH"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )
