from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required

from . import views

app_name = "coursemanaging"
urlpatterns = [
    url(r'^$', views.LandingView.as_view(),
        name='landing'),
    url(r'^course/register$', login_required(views.CourseCreateView.as_view()),
        name='course-create'),
    url(r'^course/(?P<pk>[0-9]+)/$', views.CourseDetailView.as_view(),
        name='course-detail'),
    url(r'^activities/$', views.Activities.as_view(),
        name='activities'),
    url(r'^course/update/(?P<pk>[0-9]+)/$', login_required(views.CourseUpdateView.as_view()),
        name='course-update'),
    url(r'^courses$', login_required(views.CoursesUserListView.as_view()),
        name='courses-user'),
    url(r'^course/(?P<pk>[0-9]+)/session-create$', login_required(views.SessionCreateView.as_view()),
        name='session-create'),
    url(r'^course/(?P<pk>[0-9]+)/session-user-list', login_required(views.SessionUserListView.as_view()),
        name='session-user-list'),
    url(r'^session/(?P<pk>[0-9]+)/session-update$', login_required(views.SessionUpdateView.as_view()),
        name='session-update'),
    url(r'^event/create$', login_required(views.EventCreateview.as_view()),
        name='event-create'),
    url(r'^event/(?P<pk>[0-9]+)/update$', login_required(views.EventUpdateView.as_view()),
        name='event-update'),
    url(r'^event/(?P<pk>[0-9]+)/delete', login_required(views.EventDeleteView.as_view()),
        name='event-delete'),
    url(r'^event/(?P<pk>[0-9]+)$', views.EventDetailView.as_view(),
        name='event-detail'),
    url(r'^building-day/create$', login_required(views.BuildingDayCreateview.as_view()),
        name='building-day-create'),
    url(r'^building-day/(?P<pk>[0-9]+)/building-day-update$', login_required(views.BuildingDayUpdateView.as_view()),
        name='building-day-update'),
    url(r'^building-day/(?P<pk>[0-9]+)/building-day-delete', login_required(views.BuildingDayDeleteView.as_view()),
        name='building-day-delete'),
    url(r'^building-day/(?P<pk>[0-9]+)$', login_required(views.BuildingDayDetailView.as_view()),
        name='building-day-detail'),
    url(r'^register/$', views.RegisterView.as_view(),
        name='user-register'),
    url(r'^user/$', login_required(views.UserDetailView.as_view()),
        name='user-detail'),
    url(r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.activate,
        name='user-activate'),
    url(r'^login/$', auth_views.LoginView.as_view(template_name= 'coursemanaging/user-login.html'),
        name='login'),
    url(r'^logout/$', auth_views.LogoutView.as_view(), {'next_page': '/'},
        name='logout'),
    url('^account-activation-sent', views.AccountActivationSentView.as_view(),
        name='account-activation-sent'),
    url(r'^calendar/', views.CalendarView.as_view(),
        name='calendar'),
    url(r'^blog/$', views.NewsView.as_view(),
        name='news'),
    url(r'^blog/(?P<pk>[0-9]+)$', views.NewsView.as_view(),
        name='news'),
    url(r'^impossible/$', views.ImpossibleView.as_view(),
        name='impossible'),
    url(r'^thanks/$', views.ThanksView.as_view(),
        name='thanks'),

    url(r'^ajax-calendar/$', views.get_calendar,
        name='ajax-calendar'),
    url(r'^ajax-week-calendar/$', views.get_week_calendar,
        name='ajax-calendar'),
]
