"""
URL configuration for config project.
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from .views import places, accounts, bookings, reviews, offers, favorites, notifications, static_pages, api_info

# Customize admin site
admin.site.site_header = 'Daleeli IQ - لوحة التحكم'
admin.site.site_title = 'Daleeli IQ Admin'
admin.site.index_title = 'مرحباً بك في لوحة التحكم'

urlpatterns = [
    # Home
    path('', places.index, name='index'),
    path('index/', places.index, name='index'),
    
    # Places
    path('places/', places.places_list, name='places_list'),
    path('place/<slug:slug>/', places.place_detail, name='place_detail'),
    path('place/<slug:slug>/reviews/', places.place_reviews, name='place_reviews'),
    
    # Authentication
    path('login/', accounts.login_view, name='login'),
    path('register/', accounts.register_view, name='register'),
    path('profile/', accounts.profile_view, name='profile'),
    path('password-reset/', accounts.password_reset_view, name='password_reset'),
    
    # Bookings
    path('my-bookings/', bookings.my_bookings_view, name='my_bookings'),
    path('place/<slug:slug>/book/', bookings.create_booking_view, name='create_booking'),
    
    # Reviews
    path('place/<slug:slug>/review/', reviews.create_review_view, name='create_review'),
    
    # Offers
    path('offers/', offers.offers_list_view, name='offers_list'),
    path('offer/<int:id>/', offers.offer_detail_view, name='offer_detail'),
    
    # Favorites
    path('favorites/', favorites.favorites_view, name='favorites'),
    
    # Notifications
    path('notifications/', notifications.notifications_view, name='notifications'),
    
    # Static Pages
    path('about/', static_pages.about_view, name='about'),
    path('terms/', static_pages.terms_view, name='terms'),
    path('contact/', static_pages.contact_view, name='contact'),
    
    # API & Admin
    path('api-info/', api_info, name='api_info'),
    path('admin/', admin.site.urls),
    path('api/', include('api.urls')),
]

# Serve media files in development
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    
    # Django Debug Toolbar URLs
    try:
        import debug_toolbar
        urlpatterns = [
            path('__debug__/', include(debug_toolbar.urls)),
        ] + urlpatterns
    except ImportError:
        pass
