import logging

from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import path, include, re_path

from .views.index import IndexView, LicenseActivationView, LoginTemplateView

logger_error = logging.getLogger('console.user.error')


urlpatterns = [
    re_path(r'^login/$', LoginTemplateView.as_view(), name='login'),
    re_path(r'^license/$', LicenseActivationView.as_view(), name="license_activation"),
] + i18n_patterns(re_path(r'^api/', include('console.api_urls')),)


if getattr(settings, 'ADMIN_PANEL_ENABLED', False):
    urlpatterns += i18n_patterns(
        path('admin/', admin.site.urls),
    )

# mast be in end file because it's all patter after /
urlpatterns += [
    re_path(r'^', IndexView.as_view(), name='index'),
]
