#Obsługa ścieżek używanych do zarządzania kontem użytkownika.
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views import (
     RegisterView,
     ChangePasswordView,
     ResetPasswordView,
     ResetPasswordConfirmView,
     UserViewSet,
     UserProfileView,
     ThrottledTokenObtainPairView,
     CustomTokenRefreshView,
     FavoriteView,
     UserFavoriteObjectView,
     UserFavoriteDetailView,
     AvatarView,
 )

router = DefaultRouter()
router.register(r'users-list', UserViewSet, basename='users-list')

urlpatterns = [
    path('login/', ThrottledTokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('refresh/', CustomTokenRefreshView.as_view(), name='token_refresh'),
    path('register/', RegisterView.as_view(), name='register'),
    path('change-password/', ChangePasswordView.as_view(), name='change-password'),
    path('reset-password/', ResetPasswordView.as_view(), name='reset-password'),
    path('reset-password/confirm/', ResetPasswordConfirmView.as_view(), name='reset-password-confirm'),
    path('profile/<str:username>/', UserProfileView.as_view(), name='user-profile'),
    path('favorites/', FavoriteView.as_view(), name='favorites'),
    path('<str:username>/favorites/', UserFavoriteObjectView.as_view(), name='user-favorite-objects'),
    path('<str:username>/favorites/<int:favorite_id>/', UserFavoriteDetailView.as_view(), name='user-favorite-detail'),
    path('<str:username>/avatar/', AvatarView.as_view(), name='avatar'),
]

urlpatterns += [
    path('', include(router.urls)),
]
