from django.urls import include, path
from rest_framework.routers import DefaultRouter

from .views import (
    PatientJourneyInstanceViewSet,
    PatientJourneyStageInstanceViewSet,
    PatientJourneyStageTemplateViewSet,
    PatientJourneyTemplateViewSet,
)
from . import ui_views

app_name = 'journeys'

router = DefaultRouter()
router.register(r'api/templates', PatientJourneyTemplateViewSet, basename='journey-template-api')
router.register(r'api/stage-templates', PatientJourneyStageTemplateViewSet, basename='stage-template-api')
router.register(r'api/instances', PatientJourneyInstanceViewSet, basename='journey-instance-api')
router.register(r'api/stage-instances', PatientJourneyStageInstanceViewSet, basename='stage-instance-api')

urlpatterns = [
    # UI Views
    path('instances/', ui_views.journey_instance_list, name='instance_list'),
    path('instances/<uuid:pk>/', ui_views.journey_instance_detail, name='instance_detail'),
    path('templates/', ui_views.journey_template_list, name='template_list'),
    path('templates/create/', ui_views.journey_template_create, name='template_create'),
    path('templates/<uuid:pk>/', ui_views.journey_template_detail, name='template_detail'),
    path('templates/<uuid:pk>/edit/', ui_views.journey_template_edit, name='template_edit'),
    path('templates/<uuid:pk>/delete/', ui_views.journey_template_delete, name='template_delete'),
    
    # API Routes
    path('', include(router.urls)),
]
