# -*- coding: utf-8 -*-

"""pai2 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from rest_framework import routers

from account import views as account_views
from account import tourguide_views
from group import views as group_views
from group import lensman_views
from page import views as page_views
from photo import views as photo_views
from website import views as website_views


router = routers.DefaultRouter()
# router.register(r'users', account_views.UserViewSet)
# router.register(r'groups', account_views.GroupViewSet)

router.register(r'lensmans', account_views.LensmanInfoViewSet)
router.register(r'users', account_views.UserInfoViewSet)

router.register(r'groups', group_views.GroupInfoViewSet)
router.register(r'group_users', group_views.GroupUserInfoViewSet)
router.register(r'group_photos', group_views.GroupPhotoInfoViewSet)

router.register(r'photos', photo_views.PhotoInfoViewSet)

urlpatterns = [
    url(r'^pai2admin/', include(admin.site.urls)),
]

urlpatterns += [
    # url(r'^api/', include('api.urls', namespace='api')),
    url(r'^s/(?P<session_id>\w+)$', photo_views.session_detail, name='session_detail'),  # Session 详情
    url(r'^p/(?P<photo_id>\w+)$', photo_views.photo_standard, name='photo_standard'),  # standard thumbnail, available for free
    url(r'^m/(?P<photo_id>\w+)$', photo_views.photo_medium, name='photo_medium'),  # medium/mobile version, without watermark, login or paid by others
    url(r'^l/(?P<photo_id>\w+)$', photo_views.photo_large, name='photo_large'),  # large, might support server side panning later, login required
    url(r'^r/(?P<photo_id>\w+)$', photo_views.photo_raw, name='photo_raw'),  # raw image, only for finishers
]

urlpatterns += [
    url(r'^gp/(?P<photo_id>\w+)$', group_views.group_photo_detail, name='group_photo_detail'),  # 群组照片详情
]

urlpatterns += [
    url(r'^g/(?P<group_id>\w+)$', group_views.group_detail, name='group_detail'),  # 群组详情(APP下载页)
]

urlpatterns += [
    url(r'^page/user_agreement$', page_views.user_agreement, name='user_agreement'),  # 用户协议页面
    url(r'^page/contact_us$', page_views.contact_us, name='contact_us'),  # 联系我们页面

    url(r'^page/lensman$', page_views.lensman_oauth, name='lensman_oauth'),  # 摄影师授权页面
    url(r'^page/price$', page_views.lensman_price, name='lensman_price'),  # 摄影师照片价格和分成规则

    url(r'^page/tourguide$', page_views.tourguide_oauth, name='tourguide_oauth'),  # 导游授权页面
]

urlpatterns += [
    url(r'^$', website_views.pai2_home, name='pai2_home'),  # 官网首页
    url(r'^aboutus$', website_views.pai2_aboutus, name='pai2_aboutus'),  # 官网关于我们
    url(r'^contactus$', website_views.pai2_contactus, name='pai2_contactus'),  # 官网联系我们
    url(r'^joinus$', website_views.pai2_joinus, name='pai2_joinus'),  # 官网加入我们
    url(r'^termofservice$', website_views.pai2_termofservice, name='pai2_termofservice'),  # 官网服务条款
]

# 摄影师相关
urlpatterns += [
    url(r'^page/l/submit$', lensman_views.lensman_submit_api, name='lensman_submit_api'),  # 摄影师信息提交
]

# 导游相关
urlpatterns += [
    url(r'^page/t/submit$', tourguide_views.tourguide_submit_api, name='tourguide_submit_api'),  # 导游信息提交
]

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns += [
    url(r'^api/', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
