# Path: features/steps/managers/base.py
# class BaseManager(object):
# 
#     def __init__(self, organization_factory):
#         self._organization_factory = organization_factory
#         self._organization_client = self._organization_factory. \
#             make_organization_client()
# 
#     def _get_directory_client(self, directory_id):
#         return self._organization_factory.make_directory_client(directory_id)
# 
#     def _get_service_client(self, service_id):
#         return self._organization_factory.make_service_client(service_id)
# 
#     def cleanup(self):
#         pass


from uuid import uuid4
from .base import BaseManager



class DirectoryServiceSessionManager(BaseManager):
    def __init__(self, organization_factory):
        super(DirectoryServiceSessionManager, self, ).__init__(
            organization_factory)

    def start_session(self, service_id, user_identifier, auth_request=None):
        if auth_request is None:
            auth_request = str(uuid4())
        client = self._get_service_client(service_id)
        client.session_start(
            user_identifier,
            auth_request
        )

    def end_session(self, service_id, user_identifier):
        client = self._get_service_client(service_id)

# Path: features/steps/managers/base.py
# class BaseManager(object):
# 
#     def __init__(self, organization_factory):
#         self._organization_factory = organization_factory
#         self._organization_client = self._organization_factory. \
#             make_organization_client()
# 
#     def _get_directory_client(self, directory_id):
#         return self._organization_factory.make_directory_client(directory_id)
# 
#     def _get_service_client(self, service_id):
#         return self._organization_factory.make_service_client(service_id)
# 
#     def cleanup(self):
#         pass


# Path: features/steps/managers/directory_service_session.py
from uuid import uuid4
from .base import BaseManager




class DirectoryServiceSessionManager(BaseManager):
    def __init__(self, organization_factory):
        super(DirectoryServiceSessionManager, self, ).__init__(
            organization_factory)

    def start_session(self, service_id, user_identifier, auth_request=None):
        if auth_request is None:
            auth_request = str(uuid4())
        client = self._get_service_client(service_id)
        client.session_start(
            user_identifier,
            auth_request
        )

    def end_session(self, service_id, user_identifier):
        client = self._get_service_client(service_id)

        client.session_end(user_identifier)