
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns # Import i18n_patterns
from rest_framework.routers import DefaultRouter
from recruitment import views

router = DefaultRouter()
router.register(r'jobs', views.JobPostingViewSet)
router.register(r'candidates', views.CandidateViewSet)

# 1. URLs that DO NOT have a language prefix (admin, API, static files)
urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path('accounts/', include('allauth.urls')),
    path('i18n/', include('django.conf.urls.i18n')),
    # path('summernote/', include('django_summernote.urls')),
    # path('', include('recruitment.urls')),
    path("ckeditor5/", include('django_ckeditor_5.urls')),

    path('<int:template_id>/', views.form_wizard_view, name='form_wizard'),
    path('<int:template_id>/submit/', views.submit_form, name='submit_form'),

    path('api/templates/', views.list_form_templates, name='list_form_templates'),
    path('api/templates/save/', views.save_form_template, name='save_form_template'),
    path('api/templates/<int:template_id>/', views.load_form_template, name='load_form_template'),
    path('api/templates/<int:template_id>/delete/', views.delete_form_template, name='delete_form_template'),
]

urlpatterns += i18n_patterns(
    path('', include('recruitment.urls')),
)
# 2. URLs that DO have a language prefix (user-facing views)
# This includes the root path (''), which is handled by 'recruitment.urls'

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)