from django.contrib import admin
from django.urls import path, include, re_path
from django.views.static import serve
from django.conf import settings
import user.views as tempUser
from django.conf.urls.static import static
from azbankgateways.urls import az_bank_gateways_urls

# drf_yasg code starts here
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

schema_view = get_schema_view(
    openapi.Info(
        title="Jaseci API",
        default_version='v1',
        description="Welcome to the world of Jaseci",
        terms_of_service="https://www.jaseci.org",
        contact=openapi.Contact(email="jason@jaseci.org"),
        license=openapi.License(name="Awesome IP"),
    ),
    public=True,
    permission_classes=(permissions.AllowAny,),
)
# ends here

admin.site.site_header = 'مدیریت توماشین'
admin.site.site_title = 'توماشین'

# re_path(r'^doc(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
# path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),

urlpatterns = [
    path('doc/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),

    path('ckeditor', include('ckeditor_uploader.urls')),
    re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
    re_path(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT}),

    path('adm-panel/', admin.site.urls),
    path('report_builder/', include('report_builder.urls')),
    path('bankgateways/', az_bank_gateways_urls()),
    path('payment/', include('payment.urls')),
    path('', include('core.urls')),

    path('api/user/', include('user.urls')),
    path('api/user/password-reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),
    path('api/blog/', include('blog.urls')),
    path('api/setting/', include('setting.urls')),
    path('api/seller/', include('seller.urls')),
    path('api/customer/', include('customer.urls')),
    path('api/sale/', include('sale.urls')),

    path('ajax/load-cities/', tempUser.ProvinceCities.as_view(), name='ajax_load_cities'),

    path('', include('frontend.urls')),
]
