# =============================================================
# pieteikumi/urls.py
# =============================================================
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import PieteikumsViewSet, MessageViewSet

# 1. Atsevišķs routeris tikai mūsu jaunajam Mailbox
messages_router = DefaultRouter()
messages_router.register(r'', MessageViewSet, basename='message')

# 2. Tavs esošais routeris pieteikumiem
pieteikumi_router = DefaultRouter()
pieteikumi_router.register(r'', PieteikumsViewSet, basename='pieteikumi')

urlpatterns = [
    # SVARĪGI: Mums "messages/" ir jānoķer PIRMS tukšā '', citādi tas to uztvers kā ID!
    path('messages/', include(messages_router.urls)),
    
    # Visas pārējās adreses aiziet uz parastajiem pieteikumiem
    path('', include(pieteikumi_router.urls)),
]