# Django imports
from django.urls import path, re_path

# Module imports
from .views import gallery_view, toggle_settings, special_gallery_view

###########################################################################################
# URL Patterns.                                                                           #
###########################################################################################


urlpatterns = [
    # Views.
    path("", gallery_view, name="gallery_view_root"),
    path("toggle-settings/", toggle_settings, name="toggle_settings"),
    # Special gallery routes (explicit list to avoid clashing with regular paths)
    re_path(
        r"^(?P<gallery>favorites|most-visited|recent)/(?P<path>.*)/$",
        special_gallery_view,
        name="special_gallery_view_path",
    ),
    re_path(
        r"^(?P<gallery>favorites|most-visited|recent)/$",
        special_gallery_view,
        name="special_gallery_view_root",
    ),
    # Generic gallery path (catch-all for filesystem paths)
    path("<path:path>/", gallery_view, name="gallery_view_path"),
]
