"""
Schedule App URLs
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    ResourceViewSet, EventViewSet, ParticipantViewSet,
    CustomerViewSet, ServiceViewSet, StaffViewSet, ResourceTypeViewSet,
    ScheduledTaskViewSet, TaskExecutionLogViewSet, PluginViewSet,
    PluginTemplateViewSet, PluginInstallationViewSet, EventPluginViewSet,
    GlobalEventPluginViewSet, EmailTemplateViewSet
)
from .export_views import ExportViewSet

# Create router and register viewsets
router = DefaultRouter()
router.register(r'resource-types', ResourceTypeViewSet, basename='resourcetype')
router.register(r'resources', ResourceViewSet, basename='resource')
router.register(r'appointments', EventViewSet, basename='appointment')  # Alias for frontend
router.register(r'events', EventViewSet, basename='event')
router.register(r'participants', ParticipantViewSet, basename='participant')
router.register(r'customers', CustomerViewSet, basename='customer')
router.register(r'services', ServiceViewSet, basename='service')
router.register(r'staff', StaffViewSet, basename='staff')
router.register(r'scheduled-tasks', ScheduledTaskViewSet, basename='scheduledtask')
router.register(r'task-logs', TaskExecutionLogViewSet, basename='tasklog')
router.register(r'plugins', PluginViewSet, basename='plugin')
router.register(r'plugin-templates', PluginTemplateViewSet, basename='plugintemplate')
router.register(r'plugin-installations', PluginInstallationViewSet, basename='plugininstallation')
router.register(r'event-plugins', EventPluginViewSet, basename='eventplugin')
router.register(r'global-event-plugins', GlobalEventPluginViewSet, basename='globaleventplugin')
router.register(r'email-templates', EmailTemplateViewSet, basename='emailtemplate')
router.register(r'export', ExportViewSet, basename='export')

# URL patterns
urlpatterns = [
    path('', include(router.urls)),
]
