from ..base import AdyenServiceBase


class UsersCompanyLevelApi(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 = "management"
        self.baseUrl = "https://management-test.adyen.com/v3"

    def create_new_user(self, request, companyId, idempotency_key=None, **kwargs):
        """
        Create a new user
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/users"
        method = "POST"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def get_user_details(self, companyId, userId, idempotency_key=None, **kwargs):
        """
        Get user details
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/users/{userId}"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

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

    def update_user_details(self, request, companyId, userId, idempotency_key=None, **kwargs):
        """
        Update user details
        """
        endpoint = self.baseUrl + f"/companies/{companyId}/users/{userId}"
        method = "PATCH"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )
