from rest_framework.pagination import PageNumberPagination

from N3wtSchool import settings

class CustomProfilesPagination(PageNumberPagination):
    page_size_query_param = 'page_size'
    max_page_size = settings.NB_MAX_PAGE
    page_size = settings.NB_RESULT_PROFILES_PER_PAGE

    def get_paginated_response(self, data): 
            return ({
                'links': { 
                    'next': self.get_next_link(), 
                    'previous': self.get_previous_link()
                }, 
                'count': self.page.paginator.count, 
                'page_size': self.page_size, 
                'max_page_size' : self.max_page_size,
                'profilesRoles': data }
                )