"""
Definition of urls for XCMS_PIM.
"""

from datetime import datetime
from django.urls import path, re_path
from django.contrib import admin
from django.views.generic import TemplateView
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
from XCMS_PIM import settings
from django.conf.urls.static import static
from app.views.Views import *
from django.conf.urls import handler404
from django.views.static import serve

handler404 = custom_404_view
urlpatterns = [
    path("login/", LoginView.as_view(), name="login"),
    path("initial_login/", InitialLoginView.as_view(), name="initial_login"),
    path("workspace/", WorkspaceView.as_view(), name="workspace"),
    path("management/", ManagementView.as_view(), name="management"),
    path("main/", MainView.as_view(), name="main"),
    path("error/", ErrorView.as_view(), name="error"),
    re_path(r"^static/(?P<path>.*)$", serve, {"document_root": settings.STATIC_ROOT}),
    # any other url will be redirected to login
    path("", lambda request: redirect("/login")),
    path(r'^robots.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", content_type="text/plain")),
]
