"""
    URLs mapped to the views

    Copyright 2021 Reza NasiriGerdeh, Julian Matschinske, and Reihaneh TorkzadehMahani. All Rights Reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from django.contrib import admin  # generated by Django 3.1.7.
from django.urls import path  # generated by Django 3.1.7.

from django.urls import include
from django.conf.urls import url
from rest_framework_simplejwt.views import TokenVerifyView, TokenRefreshView, TokenObtainPairView
from rest_framework import routers

from hyfed_server.view.hyfed_views import SignupView, TokenBlacklistView, UserInfo, UserViewSet, ProjectViewSet, TokenViewSet
from hyfed_server.view.hyfed_views import ProjectJoinView, ProjectInfoView, ProjectStartedView, \
    ModelAggregationView, GlobalModelView, ResultDownloadView, ProjectAuthenticationView, ModelCompensationView
from hyfed_server.model.hyfed_models import TokenModel, HyFedProjectModel
from hyfed_server.util.endpoint import EndPoint

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'projects', ProjectViewSet, basename=HyFedProjectModel)
router.register(r'tokens', TokenViewSet, basename=TokenModel)

urlpatterns = [  # generated by Django 3.1.7.
    path('admin/', admin.site.urls),  # generated by Django 3.1.7.

    # webapp-server communication: authentication
    url(r'^auth/signup/$', SignupView.as_view()),
    url(r'^auth/login/$', TokenObtainPairView.as_view()),
    url(r'^auth/logout/$', TokenBlacklistView.as_view()),
    url(r'^auth/token/refresh/$', TokenRefreshView.as_view()),
    url(r'^auth/token/verify/$', TokenVerifyView.as_view()),
    url(r'^user/info/', UserInfo.as_view()),

    # webapp-server communication: project/token creation/list
    url(r'^', include(router.urls)),

    # client-server communication
    url(r'^' + EndPoint.PROJECT_JOIN, ProjectJoinView.as_view()),
    url(r'^' + EndPoint.PROJECT_INFO, ProjectInfoView.as_view()),
    url(r'^' + EndPoint.PROJECT_STARTED, ProjectStartedView.as_view()),
    url(r'^' + EndPoint.MODEL_AGGREGATION, ModelAggregationView.as_view()),
    url(r'^' + EndPoint.GLOBAL_MODEL, GlobalModelView.as_view()),
    url(r'^' + EndPoint.RESULT_DOWNLOAD, ResultDownloadView.as_view()),

    # compensator-server communication
    url(r'^' + EndPoint.PROJECT_AUTHENTICATION, ProjectAuthenticationView.as_view()),
    url(r'^' + EndPoint.MODEL_COMPENSATION, ModelCompensationView.as_view()),

]  # generated by Django 3.1.7.
