# Path: periods/views.py
# class FlowEventViewSet(viewsets.ModelViewSet):
# class StatisticsViewSet(viewsets.ModelViewSet):
# class ApiAuthenticateView(APIView):
# class AerisView(LoginRequiredMixin, JsonView):
# class FlowEventMixin(LoginRequiredMixin):
# class FlowEventCreateView(FlowEventMixin, CreateView):
# class FlowEventUpdateView(FlowEventMixin, UpdateView):
# class FlowEventFormSetView(LoginRequiredMixin, ModelFormSetView):
# class CalendarView(LoginRequiredMixin, TemplateView):
# class CycleLengthFrequencyView(LoginRequiredMixin, JsonView):
# class CycleLengthHistoryView(LoginRequiredMixin, JsonView):
# class QigongCycleView(LoginRequiredMixin, JsonView):
# class StatisticsView(LoginRequiredMixin, TemplateView):
# class ProfileUpdateView(LoginRequiredMixin, UpdateView):
# class ApiInfoView(LoginRequiredMixin, TemplateView):
# class RegenerateKeyView(LoginRequiredMixin, UpdateView):
#     def get_queryset(self):
#     def perform_create(self, serializer):
#     def get_queryset(self):
#     def list(self, request, *args, **kwargs):
#     def post(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def convert_to_user_timezone(self, timestamp):
#     def set_to_utc(self, timestamp):
#     def get_timestamp(self):
#     def is_first_day(self, timestamp):
#     def get_initial(self):
#     def get_object(self, queryset=None):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
# def _get_level(start_date, today, cycle_length):
# def _generate_cycles(start_date, today, end_date, cycle_length):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self, *args, **kwargs):
#     def get_success_url(self):
#     def get_context_data(self, **kwargs):
#     def post(self, request, *args, **kwargs):


from django.conf.urls import include, url
from django.views.generic import RedirectView
from rest_framework import routers
from periods import views as period_views



router = routers.DefaultRouter()
router.register(r'periods', period_views.FlowEventViewSet, base_name='periods')
router.register(r'statistics', period_views.StatisticsViewSet, base_name='statistics')


urlpatterns = [
    url(r'^$', RedirectView.as_view(url='calendar/', permanent=False)),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^accounts/profile/$', period_views.ProfileUpdateView.as_view(), name='user_profile'),
    url(r'^accounts/profile/api_info/$', period_views.ApiInfoView.as_view(), name='api_info'),
    url(r'^accounts/profile/regenerate_key/$', period_views.RegenerateKeyView.as_view(),
        name='regenerate_key'),

    url(r'^api/v2/', include(router.urls)),
    url(r'^api/v2/authenticate/$', period_views.ApiAuthenticateView.as_view(), name='authenticate'),
    url(r'^api/v2/aeris/$', period_views.AerisView.as_view(), name='aeris'),
    url(r'^flow_event/$', period_views.FlowEventCreateView.as_view(), name='flow_event_create'),
    url(r'^flow_event/(?P<pk>[0-9]+)/$', period_views.FlowEventUpdateView.as_view(),
        name='flow_event_update'),
    url(r'^flow_events/$', period_views.FlowEventFormSetView.as_view(), name='flow_events'),
    url(r'^calendar/$', period_views.CalendarView.as_view(), name='calendar'),
    url(r'^statistics/$', period_views.StatisticsView.as_view(), name='statistics'),
    url(r'^statistics/cycle_length_frequency/$', period_views.CycleLengthFrequencyView.as_view()),
    url(r'^statistics/cycle_length_history/$', period_views.CycleLengthHistoryView.as_view()),

# Path: periods/views.py
# class FlowEventViewSet(viewsets.ModelViewSet):
# class StatisticsViewSet(viewsets.ModelViewSet):
# class ApiAuthenticateView(APIView):
# class AerisView(LoginRequiredMixin, JsonView):
# class FlowEventMixin(LoginRequiredMixin):
# class FlowEventCreateView(FlowEventMixin, CreateView):
# class FlowEventUpdateView(FlowEventMixin, UpdateView):
# class FlowEventFormSetView(LoginRequiredMixin, ModelFormSetView):
# class CalendarView(LoginRequiredMixin, TemplateView):
# class CycleLengthFrequencyView(LoginRequiredMixin, JsonView):
# class CycleLengthHistoryView(LoginRequiredMixin, JsonView):
# class QigongCycleView(LoginRequiredMixin, JsonView):
# class StatisticsView(LoginRequiredMixin, TemplateView):
# class ProfileUpdateView(LoginRequiredMixin, UpdateView):
# class ApiInfoView(LoginRequiredMixin, TemplateView):
# class RegenerateKeyView(LoginRequiredMixin, UpdateView):
#     def get_queryset(self):
#     def perform_create(self, serializer):
#     def get_queryset(self):
#     def list(self, request, *args, **kwargs):
#     def post(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def convert_to_user_timezone(self, timestamp):
#     def set_to_utc(self, timestamp):
#     def get_timestamp(self):
#     def is_first_day(self, timestamp):
#     def get_initial(self):
#     def get_object(self, queryset=None):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
# def _get_level(start_date, today, cycle_length):
# def _generate_cycles(start_date, today, end_date, cycle_length):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self, *args, **kwargs):
#     def get_success_url(self):
#     def get_context_data(self, **kwargs):
#     def post(self, request, *args, **kwargs):


# Path: periods/urls.py
from django.conf.urls import include, url
from django.views.generic import RedirectView
from rest_framework import routers
from periods import views as period_views




router = routers.DefaultRouter()
router.register(r'periods', period_views.FlowEventViewSet, base_name='periods')
router.register(r'statistics', period_views.StatisticsViewSet, base_name='statistics')


urlpatterns = [
    url(r'^$', RedirectView.as_view(url='calendar/', permanent=False)),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^accounts/profile/$', period_views.ProfileUpdateView.as_view(), name='user_profile'),
    url(r'^accounts/profile/api_info/$', period_views.ApiInfoView.as_view(), name='api_info'),
    url(r'^accounts/profile/regenerate_key/$', period_views.RegenerateKeyView.as_view(),
        name='regenerate_key'),

    url(r'^api/v2/', include(router.urls)),
    url(r'^api/v2/authenticate/$', period_views.ApiAuthenticateView.as_view(), name='authenticate'),
    url(r'^api/v2/aeris/$', period_views.AerisView.as_view(), name='aeris'),
    url(r'^flow_event/$', period_views.FlowEventCreateView.as_view(), name='flow_event_create'),
    url(r'^flow_event/(?P<pk>[0-9]+)/$', period_views.FlowEventUpdateView.as_view(),
        name='flow_event_update'),
    url(r'^flow_events/$', period_views.FlowEventFormSetView.as_view(), name='flow_events'),
    url(r'^calendar/$', period_views.CalendarView.as_view(), name='calendar'),
    url(r'^statistics/$', period_views.StatisticsView.as_view(), name='statistics'),
    url(r'^statistics/cycle_length_frequency/$', period_views.CycleLengthFrequencyView.as_view()),
    url(r'^statistics/cycle_length_history/$', period_views.CycleLengthHistoryView.as_view()),

    url(r'^statistics/qigong_cycles/$', period_views.QigongCycleView.as_view()),