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

from django.conf.urls import url
from django_file_upload import views as file_views

from account import tourguide_views
from account import views as account_views
from api import admin_views, clerk_views, distributor_views, encrypt_views, mch_views, model_views, operator_views, refresh_views, slide_views, sr_views
from box import views as box_views
from geo import views as geo_views
from group import (groupuser_views, lensman_views, tourguidegroup_views, tourguidegroupadmin_views,
                   tourguidegroupuser_views)
from group import views as group_views
from message import views as message_views
from miniapp import redpack_views
from miniapp import views as mini_views
from operation import views as op_views
from page import oauth_views, sale_views, screen_views
from pay import views as pay_views
from photo import views as photo_views
from sales import views as sales_views
from server import server_views
from statistic import views as tj_views


# 帐户相关
urlpatterns = [
    url(r'^u/wx/authorize$', account_views.user_wx_authorize_api, name='user_wx_authorize_api'),  # 用户端 - 微信用户授权

    url(r'^u/guest/status$', op_views.guest_api, name='user_guest_status_api'),  # 用户端 - 微游客状态(是否开启)
    url(r'^u/guest/login$', account_views.user_guest_login_api, name='user_guest_login_api'),  # 用户端 - 微游客登录
]

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

    url(r'^l/wx/authorize$', lensman_views.lensman_wx_authorize_api, name='lensman_wx_authorize_api'),  # 摄影师端 - 微信用户授权

    url(r'^l/price_fix$', lensman_views.lensman_price_fix_api, name='lensman_price_fix_api'),  # 摄影师定价

    url(r'^l/upload$', lensman_views.lensman_photo_upload_api, name='lensman_photo_upload_api'),  # 摄影师照片上传
    url(r'^l/origin_upload$', lensman_views.lensman_origin_photo_upload_api, name='lensman_origin_photo_upload_api'),  # 摄影师原图上传

    url(r'^l/brief$', lensman_views.lensman_brief_api, name='lensman_brief_api'),  # 摄影师简报
    url(r'^l/origin_wanted$', lensman_views.lensman_origin_wanted_api, name='lensman_origin_wanted_api'),  # 摄影师原图订单
]

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

    url(r'^t/wx/authorize$', tourguide_views.tourguide_wx_authorize_api, name='tourguide_wx_authorize_api'),  # 导游端 - 微信用户授权

    url(r'^t/guest/status$', op_views.guest_api, name='tourguide_guest_status_api'),  # 游端 - 游客状态(是否开启)
    url(r'^t/guest/login$', tourguide_views.tourguide_guest_login_api, name='tourguide_guest_login_api'),  # 游端 - 游客登录
]

# 群组相关
urlpatterns += [
    url(r'^g/create$', group_views.group_create_api, name='group_create_api'),  # 群组创建
    url(r'^g/detail$', group_views.group_detail_api, name='group_detail_api'),  # 群组详情
    url(r'^g/update$', group_views.group_update_api, name='group_update_api'),  # 群组更新
    url(r'^g/delete$', group_views.group_delete_api, name='group_delete_api'),  # 群组删除
    url(r'^g/list$', group_views.group_list_api, name='group_list_api'),  # 群组列表
    url(r'^g/lock$', group_views.group_lock_api, name='group_lock_api'),  # 群组锁定
    url(r'^g/unlock$', group_views.group_unlock_api, name='group_unlock_api'),  # 群组解锁
    url(r'^g/data$', group_views.group_data_api, name='group_data_api'),  # 群组数据，评论数，点赞数
]

# 群成员相关
urlpatterns += [
    url(r'^g/join$', groupuser_views.group_user_join_api, name='group_join_api'),  # 群成员加群
    url(r'^g/remove$', groupuser_views.group_user_remove_api, name='group_remove_api'),  # 群成员移除，管理员主动，群成员被动
    url(r'^g/quit$', groupuser_views.group_user_quit_api, name='group_quit_api'),  # 群成员退出，群成员主动
]

# 旅行团相关
urlpatterns += [
    url(r'^tg/create$', tourguidegroup_views.tg_group_create_api, name='tg_group_create_api'),  # 旅行团创建
    url(r'^tg/detail$', tourguidegroup_views.tg_group_detail_api, name='tg_group_detail_api'),  # 旅行团详情
    url(r'^tg/update$', tourguidegroup_views.tg_group_update_api, name='tg_group_update_api'),  # 旅行团更新
    url(r'^tg/close$', tourguidegroup_views.tg_group_close_api, name='tg_group_close_api'),  # 旅行团关闭
    url(r'^tg/gather/start$', tourguidegroup_views.tg_group_gather_start_api, name='tg_group_gather_start_api'),  # 旅行团设置集合时间和地点
    # url(r'^tg/gather/end$', tourguidegroup_views.tg_group_gather_end_api, name='tg_group_gather_end_api'),  # 旅行团集合结束，清理数据
    url(r'^tg/token$', tourguidegroup_views.tg_group_token_api, name='tg_group_token_api'),  # 旅行团权限管理票据
    url(r'^tg/transfer$', tourguidegroup_views.tg_group_transfer_api, name='tg_group_transfer_api'),  # 旅行团权限管理转移

    url(r'^tg/admin/list$', tourguidegroupadmin_views.tg_group_admin_list_api, name='tg_group_admin_list_api'),  # 旅行团管理员列表
    url(r'^tg/admin/recovery$', tourguidegroupadmin_views.tg_group_admin_recovery_api, name='tg_group_admin_recovery_api'),  # 旅行团管理员权限回收，管理员主动，团成员被动
    url(r'^tg/admin/waiver$', tourguidegroupadmin_views.tg_group_admin_waiver_api, name='tg_group_admin_waiver_api'),  # 旅行团管理员权限放弃
]

# 旅行团成员相关
urlpatterns += [
    url(r'^tgu/is_joined$', tourguidegroupuser_views.tgu_group_user_is_joined_api, name='tgu_group_user_is_joined_api'),  # 旅行团成员是否已加团
    url(r'^tgu/join$', tourguidegroupuser_views.tgu_group_user_join_api, name='tgu_group_user_join_api'),  # 旅行团成员加团
    url(r'^tgu/remove$', tourguidegroupuser_views.tgu_group_user_remove_api, name='tgu_group_user_remove_api'),  # 旅行团成员移除，管理员主动，团成员被动
    url(r'^tgu/update$', tourguidegroupuser_views.tgu_group_user_update_api, name='tg_group_update_api'),  # 旅行团成员信息更新
    url(r'^tgu/locations$', tourguidegroupuser_views.tgu_group_user_locations_api, name='tgu_group_user_locations_api'),  # 旅行团所有成员位置信息
    url(r'^tgu/location$', tourguidegroupuser_views.tgu_group_user_location_api, name='tgu_group_user_location_api'),  # 旅行团单个成员位置信息
]

# 飞图相关
urlpatterns += [
    url(r'^f/upload$', group_views.flyimg_upload_api, name='flyimg_upload_api'),  # 飞图上传
    url(r'^f/list$', group_views.flyimg_list_api, name='flyimg_list_api'),  # 飞图列表
    url(r'^f/detail$', group_views.flyimg_detail_api, name='flyimg_detail_api'),  # 飞图详情
    url(r'^f/comment/submit$', group_views.comment_submit_api, name='comment_submit_api'),  # 飞图评论提交
    url(r'^f/comment/list$', group_views.comment_list_api, name='comment_list_api'),  # 飞图评论列表
    url(r'^f/thumbup/submit$', group_views.thumbup_submit_api, name='thumbup_submit_api'),  # 飞图点赞提交
    url(r'^f/thumbup/list$', group_views.thumbup_list_api, name='thumbup_list_api'),  # 飞图点赞列表
    url(r'^f/thumbup/cancel$', group_views.thumbup_cancel_api, name='thumbup_cancel_api'),  # 飞图点赞取消
    url(r'^f/price$', group_views.lensman_photo_price, name='lensman_photo_price'),  # 摄影师照片价格获取
    url(r'^f/bought$', group_views.lensman_photo_bought, name='lensman_photo_bought'),  # 摄影师照片已购买
]

# 消息相关
urlpatterns += [
    url(r'^msg/list$', message_views.message_list_api, name='message_list_api'),  # 消息列表
    url(r'^msg/(?P<msg_type>\w+)/list$', message_views.message_type_list_api, name='message_type_list_api'),  # 分类消息列表
    url(r'^msg/(?P<msg_type>\w+)/read$', message_views.message_type_read_api, name='message_type_read_api'),  # 消息读取
    url(r'^msg/(?P<msg_type>\w+)/delete$', message_views.message_type_delete_api, name='message_type_delete_api'),  # 消息删除
]

# 控制器相关
urlpatterns += [
    url(r'^uuid_init$', photo_views.uuid_init, name='uuid_init'),  # 生成唯一标识
    url(r'^uuid$', photo_views.uuid, name='uuid'),  # 获取唯一标识
    url(r'^photos/upload$', photo_views.upload_photo, name='upload_photo'),  # 摄影师照片上传
    # url(r'^photos/raw/upload$', photo_views.upload_raw_photo, name='upload_raw_photo'),  # 摄影师高清照片上传
]

# 二维码相关
urlpatterns += [
    url(r'^s/join$', photo_views.session_join_api, name='session_join_api'),  # Session 加群
    url(r'^p/(?P<photo>\w+)$', photo_views.photo_standard_api, name='photo_standard_api'),  # standard thumbnail, available for free
]

# 系统相关
urlpatterns += [
    url(r'^op/upgrade$', op_views.upgrade_api, name='upgrade_api'),  # APP 升级
    url(r'^op/patch$', op_views.patch_api, name='patch_api'),  # APP 补丁
    url(r'^op/online$', op_views.online_api, name='online_api'),  # 是否上线
    url(r'^op/guest$', op_views.guest_api, name='guest_api'),  # 游客状态(是否开启)
    url(r'^op/splash$', op_views.splash_api, name='splash_api'),  # 启动页面
    url(r'^op/feedback$', op_views.feedback_api, name='feedback_api'),  # 用户反馈
    url(r'^op/download$', op_views.download_api, name='download_api'),  # 下载接口
    url(r'^op/bpversion$', op_views.box_program_version_api, name='box_program_version_api'),  # BOX 程序版本信息
]

# 地理位置相关
urlpatterns += [
    url(r'^geo/submit$', geo_views.geo_submit_api, name='geo_submit_api'),  # 地理位置信息提交
]

# 支付相关
urlpatterns += [
    url(r'^wx/order_create$', pay_views.wx_order_create_api, name='wx_order_create_api'),  # 订单创建
    url(r'^wx/order_query$', pay_views.wx_order_query_api, name='wx_order_query_api'),  # 订单查询补单
    url(r'^wx/order_list$', pay_views.wx_order_list_api, name='wx_order_list_api'),  # 订单列表
    url(r'^wx/order_detail$', pay_views.wx_order_detail_api, name='wx_order_detail_api'),  # 订单详情
    url(r'^wx/notify_url$', pay_views.wx_notify_url_api, name='wx_notify_url_api'),  # 支付异步通知回调地址
]

# 提现相关
urlpatterns += [
    url(r'^wx/balance_withdraw$', pay_views.wx_balance_withdraw_api, name='wx_balance_withdraw_api'),  # 余额提现: 企业付款/现金红包
]

# 首页相关
urlpatterns += [
    url(r'^kodo/home$', group_views.kodo_home_api, name='kodo_home_api'),  # 首页照片信息
    url(r'^kodo/tginfo$', tourguidegroup_views.kodo_tginfo_api, name='kodo_tginfo_api'),  # 首页旅行团信息
]

# 服务器相关
urlpatterns += [
    url(r'^s/server_time$', server_views.get_server_time_api, name='get_server_time_api'),  # 获取服务器时间
]

# Mini App
urlpatterns += [
    url(r'^mini/userinfo$', mini_views.get_userinfo_api, name='get_userinfo_api'),  # 获取用户信息
    url(r'^mini/login$', mini_views.mini_login_api, name='mini_login_api'),  # 小程序登录
    url(r'^mini/userinfo2$', mini_views.get_userinfo_api2, name='get_userinfo_api2'),  # 获取用户信息
]

urlpatterns += [
    url(r'^jsapi/hb$', redpack_views.jsapi_hb_api, name='jsapi_hb_api'),  # JSAPI红包
    url(r'^mini/hb$', redpack_views.mini_hb_api, name='mini_hb_api'),  # 小程序红包
]

urlpatterns += [
    url(r'^box/loginqr$', box_views.login_qrcode_api, name='login_qrcode_api'),  # 二维码登录
]

# Kodo
urlpatterns += [
    url(r'^login$', mch_views.optor_login_api, name='login_api'),
    url(r'^optor/login$', mch_views.optor_login_api, name='optor_login_api'),
    url(r'^admin/login$', mch_views.admin_login_api, name='admin_login_api'),
]

urlpatterns += [
    # url(r'^brands$', mch_views.brands_list, name='brands_list'),
    # url(r'^models$', mch_views.models_list, name='models_list'),
    # url(r'^distributors$', mch_views.distributors_list, name='distributors_list'),
    url(r'^infos$', mch_views.bmd_infos, name='bmd_infos'),

    url(r'^log/upload$', file_views.file_upload, name='log_upload'),
]

urlpatterns += [
    url(r'^encrypt$', encrypt_views.encrypt, name='encrypt'),
    url(r'^decrypt$', encrypt_views.decrypt, name='decrypt'),
    url(r'^decrypt2$', encrypt_views.decrypt2, name='decrypt2'),
]

urlpatterns += [
    url(r'^upgrade$', mch_views.upgrade_api, name='upgrade_api'),  # APP 升级
]

urlpatterns += [
    url(r'^consumer_phone$', mch_views.consumer_phone_api, name='consumer_phone_api'),
    url(r'^consumer_info$', mch_views.consumer_info_api, name='consumer_info_api'),
    url(r'^consumer_snlist$', mch_views.consumer_snlist_api, name='consumer_snlist_api'),
]

urlpatterns += [
    url(r'^clerk/submit$', oauth_views.clerk_submit_api, name='clerk_submit_api'),  # 店员信息提交
    url(r'^clerk/submit2$', oauth_views.clerk_submit2_api, name='clerk_submit2_api'),  # 店员信息提交
    url(r'^clerk/sale/decrypt$', sale_views.clerk_sale_decrypt_api, name='clerk_sale_decrypt_api'),
    url(r'^clerk/sale/submit$', sale_views.clerk_sale_submit_api, name='clerk_sale_submit_api'),  # 店员销售信息提交
    url(r'^clerk/integral/list$', sale_views.clerk_integral_list_api, name='clerk_integral_list_api'),  #
    url(r'^clerk/consumer/impression$', sale_views.clerk_consumer_impression_api, name='clerk_consumer_impression_api'),
]

urlpatterns += [
    url(r'^upload$', file_views.file_upload, name='file_upload'),
]

urlpatterns += [
    url(r'^membercard_extradata$', mini_views.membercard_extradata, name='membercard_extradata'),  #
]

urlpatterns += [
    url(r'^tj$', tj_views.tj_distributor, name='tj_distributor_old'),  # 统计数据(经销商维度)
    url(r'^tj/distributor$', tj_views.tj_distributor, name='tj_distributor'),  # 统计数据(经销商维度)
    url(r'^tj/consumer$', tj_views.tj_consumer, name='tj_consumer'),  # 统计数据(消费者维度)
    url(r'^tj/generate$', tj_views.tj_generate, name='tj_generate'),  # 统计数据生成

    url(r'^v2/tj$', tj_views.v2_tj_distributor, name='v2_tj_distributor'),  # 统计数据
]

urlpatterns += [
    url(r'^operator/add$', operator_views.operator_add, name='operator_add'),
    url(r'^operator/delete$', operator_views.operator_delete, name='operator_delete'),
    url(r'^operator/update$', operator_views.operator_update, name='operator_update'),
    url(r'^operator/list$', operator_views.operator_list, name='operator_list'),
]

urlpatterns += [
    url(r'^model/add$', model_views.model_add, name='model_add'),
    url(r'^model/delete$', model_views.model_delete, name='model_delete'),
    url(r'^model/update$', model_views.model_update, name='model_update'),
    url(r'^model/list$', model_views.model_list, name='model_list'),
]

urlpatterns += [
    url(r'^distributor/add$', distributor_views.distributor_add, name='distributor_add'),
    url(r'^distributor/delete$', distributor_views.distributor_delete, name='distributor_delete'),
    url(r'^distributor/update$', distributor_views.distributor_update, name='distributor_update'),
    url(r'^distributor/list$', distributor_views.distributor_list, name='distributor_list'),
    url(r'^distributor/all$', distributor_views.distributor_all, name='distributor_all'),
]

urlpatterns += [
    url(r'^clerk/add$', clerk_views.clerk_add, name='clerk_add'),
    url(r'^clerk/delete$', clerk_views.clerk_delete, name='clerk_delete'),
    url(r'^clerk/update$', clerk_views.clerk_update, name='clerk_update'),
    url(r'^clerk/list$', clerk_views.clerk_list, name='clerk_list'),
]

urlpatterns += [
    url(r'^sr/list$', sr_views.sr_list, name='sr_list'),
]

urlpatterns += [
    url(r'^screen/admin/loginqr$', screen_views.screen_admin_loginqr, name='screen_admin_loginqr'),
    url(r'^screen/admin/loginrst$', screen_views.screen_admin_loginrst, name='screen_admin_loginrst'),
]

urlpatterns += [
    url(r'^admin/querysn$', admin_views.querysn, name='querysn'),
    url(r'^admin/queryusedsn$', admin_views.queryusedsn, name='queryusedsn'),
    url(r'^admin/usecoupon$', admin_views.usecoupon, name='usecoupon'),
]

urlpatterns += [
    url(r'^slides$', slide_views.slides, name='slides'),
]

urlpatterns += [
    url(r'^refresh/phone$', refresh_views.phone, name='phone'),
]

urlpatterns += [
    url(r'^sr/submit', sales_views.sr_submit_api, name='sr_submit_api'),
    url(r'^sr/distributor/list$', sales_views.sr_distributor_list, name='sr_distributor_list'),
    url(r'^sr/distributor/tj$', sales_views.sr_distributor_tj, name='sr_distributor_tj'),
]

urlpatterns += [
    url(r'^supersr/sr/tj$', sales_views.supersr_sr_tj, name='supersr_sr_tj'),
]
