# -*- coding: utf-8 -*-
"""
Authentification URL Configuration

This module defines URL patterns for the authentification app.
All authentication-related URLs are defined here with proper naming
for easy reverse URL lookups.

URL Patterns:
    - login/: User login page
    - logout/: User logout
    - register/: User registration
    - password-reset/: Password reset request
    - password-reset-confirm/: Password reset confirmation
    - verify-email/: Email verification
    - change-password/: Password change for authenticated users
    - api/: API endpoints for AJAX/mobile requests

Author: AdTlas Development Team
Version: 1.0.0
Last Updated: 2024
"""

from django.urls import path, include
from django.contrib.auth import views as auth_views
from django.views.generic import TemplateView

from . import views

# App namespace for URL reversing
app_name = 'authentification'

# Main URL patterns
urlpatterns = [
    # Authentication views
    path(
        'login/',
        views.LoginView.as_view(),
        name='login'
    ),
    path(
        'logout/',
        views.LogoutView.as_view(),
        name='logout'
    ),
    path(
        'register/',
        views.RegisterView.as_view(),
        name='register'
    ),
    
    # Password reset views
    path(
        'password-reset/',
        views.PasswordResetView.as_view(),
        name='password_reset'
    ),
    path(
        'password-reset/done/',
        TemplateView.as_view(
            template_name='authentification/password_reset_done.html'
        ),
        name='password_reset_done'
    ),
    path(
        'password-reset-confirm/<uidb64>/<token>/',
        views.PasswordResetConfirmView.as_view(),
        name='password_reset_confirm'
    ),
    path(
        'password-reset-complete/',
        TemplateView.as_view(
            template_name='authentification/password_reset_complete.html'
        ),
        name='password_reset_complete'
    ),
    
    # Email verification
    path(
        'verify-email/<str:token>/',
        views.EmailConfirmationView.as_view(),
        name='email_confirm'
    ),
    path(
        'verification-sent/',
        TemplateView.as_view(
            template_name='authentification/verification_sent.html'
        ),
        name='verification_sent'
    ),
    
    # Password change for authenticated users
    path(
        'change-password/',
        views.ChangePasswordView.as_view(),
        name='change_password'
    ),
    
    # API endpoints for AJAX/mobile requests
    path('api/', include([
        path(
            'login/',
            views.LoginAPIView.as_view(),
            name='api_login'
        ),
        path(
            'register/',
            views.RegisterAPIView.as_view(),
            name='api_register'
        ),
        path(
            'logout/',
            auth_views.LogoutView.as_view(),
            name='api_logout'
        ),
    ])),
]

# Additional URL patterns for common authentication flows
extra_patterns = [
    # Social authentication (placeholder for future implementation)
    # path('social/', include('social_django.urls', namespace='social')),
    
    # Two-factor authentication (placeholder for future implementation)
    # path('2fa/', include('django_otp.urls')),
]

# Add extra patterns if needed
# urlpatterns += extra_patterns