from django.urls import path, re_path
from django.conf import settings
from django.conf.urls.static import static
from . import views

app_name = "blog"

urlpatterns = [
    path('car-articles', views.CarArticlesList.as_view(), name="car_articles"),
    path('car-articles-ids', views.CarArticlesIdsList.as_view(), name="car_articles_ids"),
    path('car-article/<int:pk>', views.CarArticleDetails.as_view(), name="car_article"),
    re_path(r'car-article/(?P<link>[^/]+)?$', views.CarArticleDetailsByLink.as_view(), name="car_article_by_link"),
    path('product-articles', views.ProductArticlesList.as_view(), name="product_articles"),
    path('product-articles-ids', views.ProductArticlesIdsList.as_view(), name="product_articles_ids"),
    path('product-article/<int:pk>', views.ProductArticleDetails.as_view(), name="product_article"),
    re_path(r'product-article/(?P<link>[^/]+)?$', views.ProductArticleDetailsByLink.as_view(), name="product_article_by_link"),
    path('other-articles', views.OtherArticlesList.as_view(), name="other_articles"),
    path('other-articles-ids', views.OtherArticlesIdsList.as_view(), name="other_articles_ids"),
    path('other-article/<int:pk>', views.OtherArticleDetails.as_view(), name="other_article"),
    re_path(r'other-article/(?P<link>[^/]+)?$', views.OtherArticleDetailsByLink.as_view(), name="other_article_by_link"),
    path('news', views.NewsList.as_view(), name="news"),
    path('news-ids', views.NewsIdsList.as_view(), name="news_ids"),
    path('news/<int:pk>', views.NewsDetails.as_view(), name="news_detail"),
    re_path(r'news/(?P<link>[^/]+)?$', views.NewsDetailsByLink.as_view(), name="news_detail_by_link"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)