from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import (
    SpectacularAPIView,
    SpectacularRedocView,
    SpectacularSwaggerView,
)

from portfolio import views as pages

urlpatterns = [
    path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
    path(
        "api/docs/swagger/",
        SpectacularSwaggerView.as_view(url_name="schema"),
        name="swagger-ui",
    ),
    path(
        "api/docs/redoc/",
        SpectacularRedocView.as_view(url_name="schema"),
        name="redoc",
    ),
    path("admin/", admin.site.urls),
    path("api/auth/", include("users.urls_auth")),
    path("api/profile/", include("portfolio.urls_profile")),
    path("api/teacher/", include("portfolio.urls_teacher")),
    path("api/resume/", include("resume.urls_resume")),
    path("api/templates/", include("resume.urls_templates")),
    path("api/admin/", include("users.urls_admin")),
    path("", pages.home_redirect, name="home"),
    path("login/", pages.page_login, name="login"),
    path("register/", pages.page_register, name="register"),
    path("dashboard/", pages.page_dashboard, name="dashboard"),
    path("profile/", pages.page_profile, name="profile"),
    path("resume-builder/", pages.page_resume_builder, name="resume-builder"),
    path('history/', pages.page_history, name='history'),
    path("teacher/", pages.page_teacher_students, name="teacher-students"),
    path(
        "teacher/students/<int:pk>/",
        pages.page_teacher_student_profile,
        name="teacher-student-profile",
    ),
    path("admin-panel/", pages.page_admin_panel, name="admin-panel"),
    path(
        "admin-panel/students/<int:pk>/",
        pages.page_admin_student,
        name="admin-student-detail",
    ),
    path("reset-password/", pages.page_reset_password, name="reset-password"),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
