# Path: rest_framework_extensions/etag/decorators.py
# class ETAGProcessor:
# class APIETAGProcessor(ETAGProcessor):
#     def __init__(self, etag_func=None, rebuild_after_method_evaluation=False):
#     def __call__(self, func):
#         def inner(self, request, *args, **kwargs):
#     def process_conditional_request(self,
#                                     view_instance,
#                                     view_method,
#                                     request,
#                                     args,
#                                     kwargs):
#     def get_etags_and_matchers(self, request):
#     def calculate_etag(self,
#                        view_instance,
#                        view_method,
#                        request,
#                        args,
#                        kwargs):
#     def is_if_none_match_failed(self, res_etag, etags, if_none_match):
#     def is_if_match_failed(self, res_etag, etags, if_match):
#     def _get_and_log_precondition_failed_response(self, request):
#     def __init__(self, etag_func=None, rebuild_after_method_evaluation=False, precondition_map=None):
#     def get_etags_and_matchers(self, request):
#     def evaluate_preconditions(self, request):
# 
# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]


from rest_framework_extensions.etag.decorators import etag, api_etag
from rest_framework_extensions.settings import extensions_api_settings


class UpdateETAGMixin(BaseETAGMixin):
    @etag(etag_func='object_etag_func', rebuild_after_method_evaluation=True)
    def update(self, request, *args, **kwargs):
        return super().update(request, *args, **kwargs)


class DestroyETAGMixin(BaseETAGMixin):
    @etag(etag_func='object_etag_func')
    def destroy(self, request, *args, **kwargs):
        return super().destroy(request, *args, **kwargs)


class ReadOnlyETAGMixin(RetrieveETAGMixin,
                        ListETAGMixin):
    pass


class ETAGMixin(RetrieveETAGMixin,
                UpdateETAGMixin,
                DestroyETAGMixin,
                ListETAGMixin):
    pass


class APIBaseETAGMixin:
    # todo: test me. Create generic test like test_etag(view_instance,
    # method, should_rebuild_after_method_evaluation)
    api_object_etag_func = extensions_api_settings.DEFAULT_API_OBJECT_ETAG_FUNC

# Path: rest_framework_extensions/etag/decorators.py
# class ETAGProcessor:
# class APIETAGProcessor(ETAGProcessor):
#     def __init__(self, etag_func=None, rebuild_after_method_evaluation=False):
#     def __call__(self, func):
#         def inner(self, request, *args, **kwargs):
#     def process_conditional_request(self,
#                                     view_instance,
#                                     view_method,
#                                     request,
#                                     args,
#                                     kwargs):
#     def get_etags_and_matchers(self, request):
#     def calculate_etag(self,
#                        view_instance,
#                        view_method,
#                        request,
#                        args,
#                        kwargs):
#     def is_if_none_match_failed(self, res_etag, etags, if_none_match):
#     def is_if_match_failed(self, res_etag, etags, if_match):
#     def _get_and_log_precondition_failed_response(self, request):
#     def __init__(self, etag_func=None, rebuild_after_method_evaluation=False, precondition_map=None):
#     def get_etags_and_matchers(self, request):
#     def evaluate_preconditions(self, request):
# 
# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]


# Path: rest_framework_extensions/etag/mixins.py
from rest_framework_extensions.etag.decorators import etag, api_etag
from rest_framework_extensions.settings import extensions_api_settings



class UpdateETAGMixin(BaseETAGMixin):
    @etag(etag_func='object_etag_func', rebuild_after_method_evaluation=True)
    def update(self, request, *args, **kwargs):
        return super().update(request, *args, **kwargs)


class DestroyETAGMixin(BaseETAGMixin):
    @etag(etag_func='object_etag_func')
    def destroy(self, request, *args, **kwargs):
        return super().destroy(request, *args, **kwargs)


class ReadOnlyETAGMixin(RetrieveETAGMixin,
                        ListETAGMixin):
    pass


class ETAGMixin(RetrieveETAGMixin,
                UpdateETAGMixin,
                DestroyETAGMixin,
                ListETAGMixin):
    pass


class APIBaseETAGMixin:
    # todo: test me. Create generic test like test_etag(view_instance,
    # method, should_rebuild_after_method_evaluation)
    api_object_etag_func = extensions_api_settings.DEFAULT_API_OBJECT_ETAG_FUNC

    api_list_etag_func = extensions_api_settings.DEFAULT_API_LIST_ETAG_FUNC