from ..base import AdyenServiceBase


class LegalEntitiesApi(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 = "legalEntityManagement"
        self.baseUrl = "https://kyc-test.adyen.com/lem/v4"

    def check_legal_entitys_verification_errors(self, id, idempotency_key=None, **kwargs):
        """
        Check a legal entity's verification errors
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}/checkVerificationErrors"
        method = "POST"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def confirm_data_review(self, id, idempotency_key=None, **kwargs):
        """
        Confirm data review
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}/confirmDataReview"
        method = "POST"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def create_legal_entity(self, request, idempotency_key=None, **kwargs):
        """
        Create a legal entity
        """
        endpoint = self.baseUrl + "/legalEntities"
        method = "POST"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def get_all_business_lines_under_legal_entity(self, id, idempotency_key=None, **kwargs):
        """
        Get all business lines under a legal entity
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}/businessLines"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def get_legal_entity(self, id, idempotency_key=None, **kwargs):
        """
        Get a legal entity
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}"
        method = "GET"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def request_periodic_review(self, id, idempotency_key=None, **kwargs):
        """
        Request periodic data review.
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}/requestPeriodicReview"
        method = "POST"
        return self.client.call_adyen_api(
            None, self.service, method, endpoint, idempotency_key, **kwargs
        )

    def update_legal_entity(self, request, id, idempotency_key=None, **kwargs):
        """
        Update a legal entity
        """
        endpoint = self.baseUrl + f"/legalEntities/{id}"
        method = "PATCH"
        return self.client.call_adyen_api(
            request, self.service, method, endpoint, idempotency_key, **kwargs
        )
