"""access_controller URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

from main.urls import router
from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView, registration_error
from main.views import registration_failed
from main.views import work_page, work_hand_over, work_become_engineer, work_get_tickets, \
    AdminPageView, statistic_page


urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    path('', main_page, name='index'),
    path('accounts/profile/', profile_page, name='profile'),
    path('accounts/register/', CustomRegistrationView.as_view(), name='registration'),
    path('accounts/register/error/', registration_error, name='registration_email_error'),
    path('accounts/login/', CustomLoginView.as_view(), name='login'),
    path('accounts/', include('django.contrib.auth.urls')),
    path('work/<int:required_id>', work_page, name="work"),
    path('work/hand_over/', work_hand_over, name="work_hand_over"),
    path('work/become_engineer/', work_become_engineer, name="work_become_engineer"),
    path('work/get_tickets', work_get_tickets, name='work_get_tickets'),
    path('accounts/', include('django_registration.backends.activation.urls')),
    path('registration_failed/', registration_failed, name='registration_failed'),
    path('control/', AdminPageView.as_view(), name='control'),
    path('statistic/', statistic_page, name='statistic'),
]

# Django REST
urlpatterns += [
    path('api/', include(router.urls))

]
