"""middleware URL Configuration

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

import limitmonitor.views
import purist.views
# from ldapregister.forms import RegistrationForm
from ldapregister.views import LdhLoginView

from cart.views import CartRegistrationView
from purist.views import Recovery, PasswordChange, \
    PasswordChangeDone, ProfileConfigureView, RecoveryPasswordReset
from invitation.views import InvitationRegistrationView
from password_reset.views import reset_done, recover_done
from bundlechange.views import UpgradeView

#
# Set admin titles for this site
#

admin.site.site_title = "Site administration"
admin.site.site_header = "Site administration"

#
# Define patterns for this site
#

urlpatterns = [
    url(r'^$', purist.views.home, name='home'),
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/$', RedirectView.as_view(url='/')),
    url(r'^accounts/profile/$', limitmonitor.views.userlimit, name='profile'),
    url(r'^accounts/profile/toggle_tunnel',
        limitmonitor.views.toggle_tunnel, name='toggle_tunnel'),
    url(r'^accounts/profile/new_invitation',
        limitmonitor.views.new_invitation, name='new_invitation'),
    url(r'^accounts/profile/configure',
        ProfileConfigureView.as_view(), name='profile_configure'),
    url(r'^accounts/profile/delete_account',
        purist.views.DeleteAccountView.as_view(), name='delete_account'),
    url(r'^accounts/register/(?P<layout>.+)/$', CartRegistrationView.as_view(),
        name='register_layout'),
    url(r'^accounts/register/$', CartRegistrationView.as_view(),
        name='register_full'),
    url(r'^accounts/login/$', LdhLoginView.as_view(), name='auth_login'),
    url(r'^accounts/recover/(?P<signature>.+)/$', recover_done,
        name='password_reset_sent'),
    url(r'^accounts/recover/$', Recovery.as_view(),
        name='password_reset_recover'),
    url(r'^accounts/reset/done/$', reset_done, name='password_reset_done'),
    url(r'^accounts/reset/(?P<token>[\w:-]+)/$',
        RecoveryPasswordReset.as_view(),
        name='password_reset_reset'),
    url(r'^accounts/password_change/$', PasswordChange.as_view(),
        name='password_change'),
    url(r'^accounts/password_change_done/$', PasswordChangeDone.as_view(),
        name='password_change_done'),
    url(r'^accounts/upgrade/$', UpgradeView.as_view(), name='upgrade'),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'^download/', include('django_agpl.urls')),
    url(r'^jslicense/$', purist.views.jslicense, name='jslicense'),
    url(r'^captcha/', include('captcha.urls')),
    url(r'^invitation/(?P<msg_hash>.+)/$',
        InvitationRegistrationView.as_view(),
        name="register_invitation"),
    url(r'^api/v1/user/tunnel_account',
        purist.views.UserDetail.as_view(), name='user_details'),
    url(r'^public/(?P<target>.*)',
        purist.views.public_area, name='public_area'),
    url(r'^cart/5/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'basic'}, name="register_basic"),
    url(r'^cart/6/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'basic'}, name="register_donate1"),
    url(r'^cart/8/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'basic'}, name="register_donate2"),
    url(r'^cart/1/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'complete_monthly'},
        name="register_complete_monthly"),
    url(r'^cart/2/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'complete_annual'},
        name="register_complete_annual"),
    url(r'^cart/3/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'family_monthly'}, name="register_family_monthly"),
    url(r'^cart/4/$', CartRegistrationView.as_view(),
        kwargs={'layout': 'family_annual'}, name="register_family_annual"),
]
