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

from .views import PXActionSLAConfigViewSet, PXActionViewSet, RoutingRuleViewSet
from . import ui_views

app_name = "actions"

router = DefaultRouter()
router.register(r"api/actions", PXActionViewSet, basename="px-action-api")
router.register(r"api/sla-configs", PXActionSLAConfigViewSet, basename="sla-config-api")
router.register(r"api/routing-rules", RoutingRuleViewSet, basename="routing-rule-api")

urlpatterns = [
    # UI Views
    path("", ui_views.action_list, name="action_list"),
    path("create/", ui_views.action_create, name="action_create"),
    path("create-from-ai/<uuid:complaint_id>/", ui_views.action_create_from_ai, name="action_create_from_ai"),
    path(
        "create-from-observation-ai/<uuid:observation_id>/",
        ui_views.action_create_from_observation_ai,
        name="action_create_from_observation_ai",
    ),
    path("<uuid:pk>/", ui_views.action_detail, name="action_detail"),
    path("<uuid:pk>/assign/", ui_views.action_assign, name="action_assign"),
    path("<uuid:pk>/change-status/", ui_views.action_change_status, name="action_change_status"),
    path("<uuid:pk>/add-note/", ui_views.action_add_note, name="action_add_note"),
    path("<uuid:pk>/escalate/", ui_views.action_escalate, name="action_escalate"),
    path("<uuid:pk>/approve/", ui_views.action_approve, name="action_approve"),
    # API Routes
    path("", include(router.urls)),
]
