from ..base import AdyenServiceBase


class AllowedOriginsCompanyLevelApi(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(AllowedOriginsCompanyLevelApi, self).__init__(client=client)
        self.service = "management"
        self.baseUrl = "https://management-test.adyen.com/v3"

    def create_allowed_origin(self, request, companyId, apiCredentialId, idempotency_key=None, **kwargs):
        """
        Create an allowed origin
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def delete_allowed_origin(self, companyId, apiCredentialId, originId, idempotency_key=None, **kwargs):
        """
        Delete an allowed origin
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
        method = "DELETE"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def get_allowed_origin(self, companyId, apiCredentialId, originId, idempotency_key=None, **kwargs):
        """
        Get an allowed origin
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

    def list_allowed_origins(self, companyId, apiCredentialId, idempotency_key=None, **kwargs):
        """
        Get a list of allowed origins
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins"
        method = "GET"
        return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs)

