# Path: apps/api/views/v2.py
# TIMEOUT = 60
#     INVALID_CALL = 'INVALID_CALL'
#     INVALID_SERVICE = 'INVALID_SERVICE'
#     INVALID_SIGN = 'INVALID_SIGN'
#     INVALID_STATE = 'INVALID_STATE'
#     INVALID_TIMESTAMP = 'INVALID_TIMESTAMP'
#     INVALID_URL = 'INVALID_URL'
# class TokenFailReason(Enum):
# class TokenRequireView(APIView):
# class TokenInfoView(APIView):
# class NoticeView(APIView):
# class EmailView(APIView):
# def date2str(obj):
# def str2date(string, default):
# def extract_flag(flags):
# def check_sign(data, keys):
# def build_suspicious_api_response(code: str, status_code: int = 400):
#     def get(self, request):
#     def post(self, request: Request):
# def logout(request):
# def point(request):
#     def get(self, request):
#     def get(self, request):
# def stats(request):
#     def filter_data(raw_data, level):


import json
import time
from django.http import HttpResponse
from django.urls import path
from apps.api.views import v2




# /versions/
def versions(request):
    resp = {
        'versions': ['v2'],
        'timestamp': int(time.time()),
    }
    return HttpResponse(json.dumps(resp), content_type='application/json')


urlpatterns = [
    path('versions/', versions),

    # VERSION 2 #
    path('v2/token/require/', v2.TokenRequireView.as_view()),
    path('v2/token/info/', v2.TokenInfoView.as_view()),
    path('v2/logout/', v2.logout),
    path('v2/point/', v2.point),
    path('v2/notice/', v2.NoticeView.as_view()),

# Path: apps/api/views/v2.py
# TIMEOUT = 60
#     INVALID_CALL = 'INVALID_CALL'
#     INVALID_SERVICE = 'INVALID_SERVICE'
#     INVALID_SIGN = 'INVALID_SIGN'
#     INVALID_STATE = 'INVALID_STATE'
#     INVALID_TIMESTAMP = 'INVALID_TIMESTAMP'
#     INVALID_URL = 'INVALID_URL'
# class TokenFailReason(Enum):
# class TokenRequireView(APIView):
# class TokenInfoView(APIView):
# class NoticeView(APIView):
# class EmailView(APIView):
# def date2str(obj):
# def str2date(string, default):
# def extract_flag(flags):
# def check_sign(data, keys):
# def build_suspicious_api_response(code: str, status_code: int = 400):
#     def get(self, request):
#     def post(self, request: Request):
# def logout(request):
# def point(request):
#     def get(self, request):
#     def get(self, request):
# def stats(request):
#     def filter_data(raw_data, level):


# Path: apps/api/urls.py
import json
import time
from django.http import HttpResponse
from django.urls import path
from apps.api.views import v2





# /versions/
def versions(request):
    resp = {
        'versions': ['v2'],
        'timestamp': int(time.time()),
    }
    return HttpResponse(json.dumps(resp), content_type='application/json')


urlpatterns = [
    path('versions/', versions),

    # VERSION 2 #
    path('v2/token/require/', v2.TokenRequireView.as_view()),
    path('v2/token/info/', v2.TokenInfoView.as_view()),
    path('v2/logout/', v2.logout),
    path('v2/point/', v2.point),
    path('v2/notice/', v2.NoticeView.as_view()),

    path('v2/email/', v2.EmailView.as_view()),