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

from .views import (
    DepartmentViewSet,
    HospitalViewSet,
    OrganizationViewSet,
    PatientViewSet,
    StaffViewSet,
)
from . import ui_views

app_name = 'organizations'

router = DefaultRouter()
router.register(r'api/organizations', OrganizationViewSet, basename='organization-api')
router.register(r'api/hospitals', HospitalViewSet, basename='hospital-api')
router.register(r'api/departments', DepartmentViewSet, basename='department-api')
router.register(r'api/staff', StaffViewSet, basename='staff-api')
router.register(r'api/patients', PatientViewSet, basename='patient-api')

urlpatterns = [
    # UI Views
    path('organizations/', ui_views.organization_list, name='organization_list'),
    path('organizations/create/', ui_views.organization_create, name='organization_create'),
    path('organizations/<uuid:pk>/', ui_views.organization_detail, name='organization_detail'),
    path('hospitals/', ui_views.hospital_list, name='hospital_list'),
    path('departments/', ui_views.department_list, name='department_list'),
    path('staff/', ui_views.staff_list, name='staff_list'),
    path('staff/create/', ui_views.staff_create, name='staff_create'),
    path('staff/<uuid:pk>/', ui_views.staff_detail, name='staff_detail'),
    path('staff/<uuid:pk>/edit/', ui_views.staff_update, name='staff_update'),
    path('patients/', ui_views.patient_list, name='patient_list'),

    # API Routes
    path('', include(router.urls)),
]
