from django.conf import settings as s
from ninja import Router
from ninja_extra.pagination import paginate

from epdb.logic import SettingManager

from ..pagination import EnhancedPageNumberPagination
from ..schemas import SettingOutSchema

router = Router()


@router.get("/settings/", response=EnhancedPageNumberPagination.Output[SettingOutSchema])
@paginate(
    EnhancedPageNumberPagination,
    page_size=s.API_PAGINATION_DEFAULT_PAGE_SIZE,
)
def list_all_settings(request):
    """
    List all settings the user has access to.
    """
    user = request.user
    return SettingManager.get_all_settings(user)
