from django.urls import path, include
from rest_framework.routers import DefaultRouter
from core.api_views import BookmarkViewSet, TeamViewSet
from core.views import (
    BookmarkListView, BookmarkCreateView, BookmarkDetailView, 
    BookmarkUpdateView, BookmarkDeleteView,
    TeamListView, TeamDetailView, BookmarkShareToggleView
)

router = DefaultRouter()
router.register(r'bookmarks', BookmarkViewSet, basename='api-bookmark')
router.register(r'teams', TeamViewSet, basename='api-team')

urlpatterns = [
    path("", BookmarkListView.as_view(), name="home"),
    path("bookmark/add/", BookmarkCreateView.as_view(), name="bookmark-add"),
    path("bookmark/<int:pk>/", BookmarkDetailView.as_view(), name="bookmark-detail"),
    path("bookmark/<int:pk>/edit/", BookmarkUpdateView.as_view(), name="bookmark-edit"),
    path("bookmark/<int:pk>/delete/", BookmarkDeleteView.as_view(), name="bookmark-delete"),
    path("bookmark/<int:pk>/share/<int:team_id>/", BookmarkShareToggleView.as_view(), name="bookmark-share-toggle"),
    
    path("teams/", TeamListView.as_view(), name="team-list"),
    path("teams/<int:pk>/", TeamDetailView.as_view(), name="team-detail"),
    
    path("api/", include(router.urls)),
]