# Path: rest_framework_extensions/routers.py
# class ExtendedSimpleRouter(ExtendedRouterMixin, SimpleRouter):
#     pass
# 
# Path: tests_app/tests/functional/routers/nested_router_mixin/views.py
# class UserViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = UserModel.objects.all()
#     serializer_class = UserSerializer
# 
#     @action(detail=False, methods=['post'], url_path='users-list-action')
#     def users_list_action(self, request, *args, **kwargs):
#         return Response('users list action')
# 
#     @action(detail=True, methods=['post'], url_path='users-action')
#     def users_action(self, request, *args, **kwargs):
#         return Response('users action')
# 
# class GroupViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = GroupModel.objects.all()
#     serializer_class = GroupSerializer
# 
#     @action(detail=False, url_path='groups-list-link')
#     def groups_list_link(self, request, *args, **kwargs):
#         return Response('groups list link')
# 
#     @action(detail=True, url_path='groups-link')
#     def groups_link(self, request, *args, **kwargs):
#         return Response('groups link')
# 
# class PermissionViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = PermissionModel.objects.all()
#     serializer_class = PermissionSerializer
# 
#     @action(detail=False, methods=['post'], url_path='permissions-list-action')
#     def permissions_list_action(self, request, *args, **kwargs):
#         return Response('permissions list action')
# 
#     @action(detail=True, methods=['post'], url_path='permissions-action')
#     def permissions_action(self, request, *args, **kwargs):
#         return Response('permissions action')


from rest_framework_extensions.routers import ExtendedSimpleRouter
from .views import (
    UserViewSet,
    GroupViewSet,
    PermissionViewSet,
)



router = ExtendedSimpleRouter()
# main routes
(
    router.register(r'users', UserViewSet)
          .register(r'groups', GroupViewSet, 'users-group', parents_query_lookups=['user_groups'])
          .register(r'permissions', PermissionViewSet, 'users-groups-permission', parents_query_lookups=['group__user', 'group'])
)

# register on one depth

# Path: rest_framework_extensions/routers.py
# class ExtendedSimpleRouter(ExtendedRouterMixin, SimpleRouter):
#     pass
# 
# Path: tests_app/tests/functional/routers/nested_router_mixin/views.py
# class UserViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = UserModel.objects.all()
#     serializer_class = UserSerializer
# 
#     @action(detail=False, methods=['post'], url_path='users-list-action')
#     def users_list_action(self, request, *args, **kwargs):
#         return Response('users list action')
# 
#     @action(detail=True, methods=['post'], url_path='users-action')
#     def users_action(self, request, *args, **kwargs):
#         return Response('users action')
# 
# class GroupViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = GroupModel.objects.all()
#     serializer_class = GroupSerializer
# 
#     @action(detail=False, url_path='groups-list-link')
#     def groups_list_link(self, request, *args, **kwargs):
#         return Response('groups list link')
# 
#     @action(detail=True, url_path='groups-link')
#     def groups_link(self, request, *args, **kwargs):
#         return Response('groups link')
# 
# class PermissionViewSet(NestedViewSetMixin, ModelViewSet):
#     queryset = PermissionModel.objects.all()
#     serializer_class = PermissionSerializer
# 
#     @action(detail=False, methods=['post'], url_path='permissions-list-action')
#     def permissions_list_action(self, request, *args, **kwargs):
#         return Response('permissions list action')
# 
#     @action(detail=True, methods=['post'], url_path='permissions-action')
#     def permissions_action(self, request, *args, **kwargs):
#         return Response('permissions action')


# Path: tests_app/tests/functional/routers/nested_router_mixin/urls.py
from rest_framework_extensions.routers import ExtendedSimpleRouter
from .views import (
    UserViewSet,
    GroupViewSet,
    PermissionViewSet,
)




router = ExtendedSimpleRouter()
# main routes
(
    router.register(r'users', UserViewSet)
          .register(r'groups', GroupViewSet, 'users-group', parents_query_lookups=['user_groups'])
          .register(r'permissions', PermissionViewSet, 'users-groups-permission', parents_query_lookups=['group__user', 'group'])
)

# register on one depth

permissions_routes = router.register(r'permissions', PermissionViewSet)