from django.contrib.auth import views as auth_views
from django.urls import path, reverse_lazy

from . import views

app_name = 'accounts'

urlpatterns = [
    path('login/', views.login_view, name='login'),
    path('logout/', views.logout_view, name='logout'),
    path('register/', views.register_view, name='register'),
    path('me/', views.profile_redirect_view, name='profile'),
    path('settings/', views.account_settings_view, name='settings'),
    path('notifications/', views.notifications_view, name='notifications'),
    path('notifications/read-all/', views.notifications_mark_all_read, name='notifications_read_all'),
    path('notifications/clear-read/', views.notifications_clear_read, name='notifications_clear_read'),
    path('notifications/<int:pk>/open/', views.notification_open, name='notification_open'),
    path('notifications/<int:pk>/toggle/', views.notification_toggle_read, name='notification_toggle'),
    path('notifications/<int:pk>/delete/', views.notification_delete, name='notification_delete'),
    path(
        'password-reset/',
        auth_views.PasswordResetView.as_view(
            template_name='accounts/password_reset_form.html',
            email_template_name='accounts/password_reset_email.txt',
            subject_template_name='accounts/password_reset_subject.txt',
            success_url=reverse_lazy('accounts:password_reset_done'),
        ),
        name='password_reset',
    ),
    path(
        'password-reset/done/',
        auth_views.PasswordResetDoneView.as_view(
            template_name='accounts/password_reset_done.html',
        ),
        name='password_reset_done',
    ),
    path(
        'password-reset/<uidb64>/<token>/',
        auth_views.PasswordResetConfirmView.as_view(
            template_name='accounts/password_reset_confirm.html',
            success_url=reverse_lazy('accounts:password_reset_complete'),
        ),
        name='password_reset_confirm',
    ),
    path(
        'password-reset/complete/',
        auth_views.PasswordResetCompleteView.as_view(
            template_name='accounts/password_reset_complete.html',
        ),
        name='password_reset_complete',
    ),
]
