from django.urls import path
from . import views
from .views import *
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView, TemplateView
from django.conf.urls import url, include

urlpatterns = [
    path('', RedirectView.as_view(url='products/'), name='index'),
    path('about/', views.about, name='about'),
    path('submit/', views.submit, name='submit'),
    path('products/', views.ProductsView.as_view(), name='products'),
    path('products/search', views.SearchProductsView.as_view(), name='search-products'),
    path('products-list/', views.ProductsListView.as_view(), name='products-list'),
    path('products-list/embed', views.ProductsListView.as_view(  embed=True,  ), name='products-list-embed'),
    path('agent_newsletter/', views.AgentNewslwtterFormView.as_view(), name='search-agent-form'),
    path('agent_newsletter/embed/', views.AgentNewslwtterFormView.as_view( embed=True, ), name='search-agent-form-embed'),
    path('agent_newsletter/<slug:newsletter_slug>/anmelden/', views.AgentNewslwtterSubscribeView.as_view(   ), name='agent-newsletter-create'),
    # path('agent_newsletter/<slug:newsletter_slug>/anmelden/embed/', views.AgentNewslwtterSubscribeView.as_view( embed=True,  ), name='agent-newsletter-create-embed'),
    # path('agent_newsletter/anmelden', views.AgentNewslwtterSubscribeView.as_view(), name='search-agent-create'),
    # path('suchagent/', views.SearchAgentCreate.as_view(), name='search-agent-create'),
    # path('suchagent/embed', views.SearchAgentCreate.as_view( embed=True, ), name='search-agent-create-embed'),
    path('suchagent/<int:pk>/<slug:hash>/', views.SearchAgentDelete.as_view(), name='search-agent-delete'),
    path('product/<int:pk>/', views.DetailView.as_view(), name='product-detail'),
    path('product/delete/<int:pk>/', views.ProductDelete.as_view(), name='product-delete'),
    path('product/<int:pk>/embed', views.DetailView.as_view( embed=True, ), name='product-detail-embed'),
    path('product-card/<int:pk>', views.CardDetailView.as_view(), name='product-detail-card'),
    path('product-card/<int:pk>/embed', views.CardDetailView.as_view( embed=True, ), name='product-detail-card-embed'),
    path('admin_panel/', views.AdminView.as_view(), name='admin-panel'),
    # path('light-box/', lightboximg.as_view(template_name="mab18/importold.html"),name='lightbox'),
    path('register/', views.registerView.as_view(), name='register-view'),
    path('addProduct/', views.NewWohnprojektView.as_view(), name='new-submit-view'),
    path('myProducts/', views.UsersProducts.as_view(), name='my-products'),
    path('editProduct/<int:pk>', views.EditView.as_view(), name='edit-product'),
    path('addImage/<int:pk>', views.uploadView.as_view(), name='add-Image'),
    # path('generic-test/', views.genericView.as_view(), name='generic-test'),
    path('pages/<slug:page>/', pagesView.as_view(template_name="marktplatz/generic.html"), name='pages-generic'),
    path('generic/', TemplateView.as_view(template_name="marktplatz/generic.html"), name='generic'),
    path('images/<int:pk>', views.MediaView.as_view(), name='media-overview'),
    url(r'^delete_media/(?P<pk>\d+)/$', views.delete_media, name='delete-media'),
    url(r'^delete_video/(?P<pk>\d+)/$', views.delete_video, name='delete-video'),
    url(r'^upload/', include('django_file_form.urls')),
    url(r'^handle_upload$', views.handle_upload, name='file_form_handle_upload'),
    url(r'^upload_mab$', views.handle_upload, name='upload_mab'),
    url(r'^home', views.home, name='home'),
    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
