# Path: sqlviewer/glimpse/views.py
# def models_list_view(request):
# def model_version_details_view(request, model_id, version_id):
# def diagram_details_view(request, model_id, version_id, diagram_id):
# def model_upload_view(request):
# def version_search_view(request, model_id, version_id):
# 
# Path: sqlviewer/connect/views.py
# def connect_view(request, model_id, version_id):


from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.views import login as login_view
from django.contrib.auth.views import logout as logout_view
from sqlviewer.glimpse import views as glimpse_views
from sqlviewer.connect import views as connect_views
import sqlviewer.glimpse.api
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. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""


# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.

api = [
    url(r'^api/v1/models/(?P<model_id>\d+)?$', sqlviewer.glimpse.api.ModelView.as_view()),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)?$', sqlviewer.glimpse.api.VersionView.as_view()),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/tables(/)?$', sqlviewer.glimpse.api.table_details, name='api-table-details'),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/diagrams/(?P<diagram_id>\d+)?$', sqlviewer.glimpse.api.DiagramView.as_view()),
]
pages = [
    url(r'^$', glimpse_views.models_list_view, name="home"),
    url(r'^admin/', admin.site.urls),
    url(r'^models/upload$', glimpse_views.model_upload_view, name='model_upload'),
    url(r'^accounts/login/$', login_view, name='login'),
    url(r'^accounts/logout/$', logout_view, name='logout'),
    url(r'^models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)$', glimpse_views.model_version_details_view, name='model_details'),
    url(r'^models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/connect$', connect_views.connect_view, name='glimpse-connect'),

# Path: sqlviewer/glimpse/views.py
# def models_list_view(request):
# def model_version_details_view(request, model_id, version_id):
# def diagram_details_view(request, model_id, version_id, diagram_id):
# def model_upload_view(request):
# def version_search_view(request, model_id, version_id):
# 
# Path: sqlviewer/connect/views.py
# def connect_view(request, model_id, version_id):


# Path: sqlviewer/urls.py
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.views import login as login_view
from django.contrib.auth.views import logout as logout_view
from sqlviewer.glimpse import views as glimpse_views
from sqlviewer.connect import views as connect_views
import sqlviewer.glimpse.api

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. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""


# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.

api = [
    url(r'^api/v1/models/(?P<model_id>\d+)?$', sqlviewer.glimpse.api.ModelView.as_view()),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)?$', sqlviewer.glimpse.api.VersionView.as_view()),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/tables(/)?$', sqlviewer.glimpse.api.table_details, name='api-table-details'),
    url(r'^api/v1/models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/diagrams/(?P<diagram_id>\d+)?$', sqlviewer.glimpse.api.DiagramView.as_view()),
]
pages = [
    url(r'^$', glimpse_views.models_list_view, name="home"),
    url(r'^admin/', admin.site.urls),
    url(r'^models/upload$', glimpse_views.model_upload_view, name='model_upload'),
    url(r'^accounts/login/$', login_view, name='login'),
    url(r'^accounts/logout/$', logout_view, name='logout'),
    url(r'^models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)$', glimpse_views.model_version_details_view, name='model_details'),
    url(r'^models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/connect$', connect_views.connect_view, name='glimpse-connect'),

    url(r'^models/(?P<model_id>\d+)/versions/(?P<version_id>\d+)/search$', glimpse_views.version_search_view, name='version_search'),