from django.urls import include, path

from . import views

urlpatterns = [
    # Comments
    path('comments/', include([
        path(
            '',
            views.CommentListView.as_view(),
            name='comment-list'
        ),
        path(
            'new/',
            views.CommentCreateView.as_view(),
            name='comment-create'
        ),
        path('<int:pk>/', include([
            path(
                '',
                views.CommentDetailView.as_view(),
                name='comment-detail'
            ),
            path(
                'update/',
                views.CommentUpdateView.as_view(),
                name='comment-update'
            ),
            path(
                'delete/',
                views.CommentDeleteView.as_view(),
                name='comment-delete'
            ),
        ])),
    ])),

    # Topics
    path('', include([
        path(
            '',
            views.TopicListView.as_view(),
            name='topic-list'
        ),
        path(
            'topics/new/',
            views.TopicCreateView.as_view(),
            name='topic-create'
        ),
        path('topics/<int:topic_pk>/', include([
            path(
                '',
                views.TopicDetailView.as_view(),
                name='topic-detail'
            ),
            path(
                'update/',
                views.TopicUpdateView.as_view(),
                name='topic-update'
            ),
            path(
                'delete/',
                views.TopicDeleteView.as_view(),
                name='topic-delete'
            ),

            # Posts
            path('posts/', include([
                path(
                    '',
                    views.PostListView.as_view(),
                    name='post-list'
                ),
                path(
                    'new/',
                    views.PostCreateView.as_view(),
                    name='post-create'
                ),
                path('<int:post_pk>/', include([
                    path(
                        '',
                        views.PostDetailView.as_view(),
                        name='post-detail'
                    ),
                    path(
                        'update/',
                        views.PostUpdateView.as_view(),
                        name='post-update'
                    ),
                    path(
                        'delete/',
                        views.PostDeleteView.as_view(),
                        name='post-delete'
                    ),
                ])),
            ])),
        ])),
    ])),
]
