# Path: djangoevents/domain.py
# class BaseAggregate(EventSourcedEntity):
# class BaseEntity(BaseAggregate):
#     def is_abstract_class(cls):
#     def mutate(cls, aggregate=None, event=None):
#     def create_for_event(cls, event):
#     def is_abstract_class(cls):
#     def mutate(cls, entity=None, event=None):
# 
# Path: djangoevents/schema.py
# def get_event_version(event_cls):
#     return getattr(event_cls, 'version', None) or 1
# 
# Path: djangoevents/settings.py
# def adds_schema_version_to_event_data():
#     config = get_config()
#     return config.get('ADDS_SCHEMA_VERSION_TO_EVENT_DATA', False)
# 
# Path: djangoevents/utils.py
# def camel_case_to_snake_case(text):
# 
#     def repl(match):
#         sep = match.group().lower()
#         if match.start() > 0:
#             sep = '_%s' % sep
#         return sep
# 
#     return re.sub(r'[A-Z][a-z]', repl, text).lower()


from .domain import DomainEvent
from .schema import get_event_version
from .settings import adds_schema_version_to_event_data
from .utils import camel_case_to_snake_case
from collections import namedtuple
from datetime import datetime
from eventsourcing.domain.model.events import resolve_attr
from eventsourcing.domain.services.transcoding import AbstractTranscoder
from eventsourcing.domain.services.transcoding import ObjectJSONDecoder
from eventsourcing.domain.services.transcoding import id_prefix_from_event
from eventsourcing.domain.services.transcoding import make_stored_entity_id
from eventsourcing.utils.time import timestamp_from_uuid
from inspect import isclass
import importlib
import json
        """
        try:
            module = importlib.import_module(module_name)
        except ImportError as e:
            raise ResolveDomainFailed("{}#{}: {}".format(module_name, class_name, e))
        try:
            domain_event_class = resolve_attr(module, class_name)
        except AttributeError as e:
            raise ResolveDomainFailed("{}#{}: {}".format(module_name, class_name, e))

        if not isclass(domain_event_class):
            raise ValueError("Event class is not a type: {}".format(domain_event_class))

        if not issubclass(domain_event_class, DomainEvent):
            raise ValueError("Event class is not a DomainEvent: {}".format(domain_event_class))

        return domain_event_class

    def _json_encode(self, data):
        return json.dumps(data, separators=(',', ':'), sort_keys=True, cls=self.json_encoder_cls)

    def _json_decode(self, json_str):
        return json.loads(json_str, cls=ObjectJSONDecoder)


class ResolveDomainFailed(Exception):
    pass


def get_aggregate_type(domain_event):

# Path: djangoevents/domain.py
# class BaseAggregate(EventSourcedEntity):
# class BaseEntity(BaseAggregate):
#     def is_abstract_class(cls):
#     def mutate(cls, aggregate=None, event=None):
#     def create_for_event(cls, event):
#     def is_abstract_class(cls):
#     def mutate(cls, entity=None, event=None):
# 
# Path: djangoevents/schema.py
# def get_event_version(event_cls):
#     return getattr(event_cls, 'version', None) or 1
# 
# Path: djangoevents/settings.py
# def adds_schema_version_to_event_data():
#     config = get_config()
#     return config.get('ADDS_SCHEMA_VERSION_TO_EVENT_DATA', False)
# 
# Path: djangoevents/utils.py
# def camel_case_to_snake_case(text):
# 
#     def repl(match):
#         sep = match.group().lower()
#         if match.start() > 0:
#             sep = '_%s' % sep
#         return sep
# 
#     return re.sub(r'[A-Z][a-z]', repl, text).lower()


# Path: djangoevents/unifiedtranscoder.py
from .domain import DomainEvent
from .schema import get_event_version
from .settings import adds_schema_version_to_event_data
from .utils import camel_case_to_snake_case
from collections import namedtuple
from datetime import datetime
from eventsourcing.domain.model.events import resolve_attr
from eventsourcing.domain.services.transcoding import AbstractTranscoder
from eventsourcing.domain.services.transcoding import ObjectJSONDecoder
from eventsourcing.domain.services.transcoding import id_prefix_from_event
from eventsourcing.domain.services.transcoding import make_stored_entity_id
from eventsourcing.utils.time import timestamp_from_uuid
from inspect import isclass
import importlib
import json

        """
        try:
            module = importlib.import_module(module_name)
        except ImportError as e:
            raise ResolveDomainFailed("{}#{}: {}".format(module_name, class_name, e))
        try:
            domain_event_class = resolve_attr(module, class_name)
        except AttributeError as e:
            raise ResolveDomainFailed("{}#{}: {}".format(module_name, class_name, e))

        if not isclass(domain_event_class):
            raise ValueError("Event class is not a type: {}".format(domain_event_class))

        if not issubclass(domain_event_class, DomainEvent):
            raise ValueError("Event class is not a DomainEvent: {}".format(domain_event_class))

        return domain_event_class

    def _json_encode(self, data):
        return json.dumps(data, separators=(',', ':'), sort_keys=True, cls=self.json_encoder_cls)

    def _json_decode(self, json_str):
        return json.loads(json_str, cls=ObjectJSONDecoder)


class ResolveDomainFailed(Exception):
    pass


def get_aggregate_type(domain_event):

    assert isinstance(domain_event, DomainEvent)