# Path: hedwig/django/settings.py
# HEDWIG_USER_SETTINGS = getattr(settings, 'HEDWIG', None)
# HEDWIG_DJANGO_USER_SETTINGS = getattr(settings, 'HEDWIG_DJANGO', None)
# DJANGO_DEFAULTS = {
#     'MODEL_SIGNALS': False,
#     'HIDE_FIELDS': False,
#     'NATURAL_PRIMARY_KEYS': True,
#     'NATURAL_FOREIGN_KEYS': True
# }
# MODEL_DEFAULTS = {
#     'fields': not bool(hedwig_django_settings.HIDE_FIELDS),
#     'natural_primary_keys': bool(hedwig_django_settings.NATURAL_PRIMARY_KEYS),
#     'natural_foreign_keys': bool(hedwig_django_settings.NATURAL_FOREIGN_KEYS),
#     'created': True,
#     'updated': True,
#     'deleted': True
# }
# 
# Path: hedwig/rest_framework/settings.py
# REST_FRAMEWORK_DEFAULTS = {
#     'SERIALIZER_SIGNALS': True
# }
# HEDWIG_REST_FRAMEWORK_USER_SETTINGS = getattr(settings, 'HEDWIG_REST_FRAMEWORK', None)
# 
# Path: hedwig/django/emitter.py



from rest_framework.serializers import ModelSerializer
from rest_framework.renderers import JSONRenderer
from hedwig.django.settings import project_name
from .settings import hedwig_rest_framework_settings
from hedwig.django.emitter import hedwig_emitter


class HedwigModelSerializer(ModelSerializer):
    def save(self, **kwargs):
        action = 'created'
        if self.instance is not None:
            action = 'updated'
        super(HedwigModelSerializer, self).save(**kwargs)
        emit_hedwig_serializer_data(action, self.__module__.split('.')[0], self.__class__.__name__, self)
        return self.instance


def emit_hedwig_serializer_data(action, module_name, serializer_name, serializer):

# Path: hedwig/django/settings.py
# HEDWIG_USER_SETTINGS = getattr(settings, 'HEDWIG', None)
# HEDWIG_DJANGO_USER_SETTINGS = getattr(settings, 'HEDWIG_DJANGO', None)
# DJANGO_DEFAULTS = {
#     'MODEL_SIGNALS': False,
#     'HIDE_FIELDS': False,
#     'NATURAL_PRIMARY_KEYS': True,
#     'NATURAL_FOREIGN_KEYS': True
# }
# MODEL_DEFAULTS = {
#     'fields': not bool(hedwig_django_settings.HIDE_FIELDS),
#     'natural_primary_keys': bool(hedwig_django_settings.NATURAL_PRIMARY_KEYS),
#     'natural_foreign_keys': bool(hedwig_django_settings.NATURAL_FOREIGN_KEYS),
#     'created': True,
#     'updated': True,
#     'deleted': True
# }
# 
# Path: hedwig/rest_framework/settings.py
# REST_FRAMEWORK_DEFAULTS = {
#     'SERIALIZER_SIGNALS': True
# }
# HEDWIG_REST_FRAMEWORK_USER_SETTINGS = getattr(settings, 'HEDWIG_REST_FRAMEWORK', None)
# 
# Path: hedwig/django/emitter.py



# Path: hedwig/rest_framework/serializers.py
from rest_framework.serializers import ModelSerializer
from rest_framework.renderers import JSONRenderer
from hedwig.django.settings import project_name
from .settings import hedwig_rest_framework_settings
from hedwig.django.emitter import hedwig_emitter



class HedwigModelSerializer(ModelSerializer):
    def save(self, **kwargs):
        action = 'created'
        if self.instance is not None:
            action = 'updated'
        super(HedwigModelSerializer, self).save(**kwargs)
        emit_hedwig_serializer_data(action, self.__module__.split('.')[0], self.__class__.__name__, self)
        return self.instance


def emit_hedwig_serializer_data(action, module_name, serializer_name, serializer):

    if not bool(hedwig_rest_framework_settings.SERIALIZER_SIGNALS):