"""API URLs for channels app.

This module defines the URL patterns for the channels app API endpoints.
It includes routes for channels, zones, shows, EPG entries, codecs, and jingles.
"""

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

# Create a router and register our viewsets with it
router = DefaultRouter()
router.register(r'channels', views.ChannelViewSet, basename='channel')
router.register(r'zones', views.ZoneViewSet, basename='zone')
router.register(r'shows', views.ShowViewSet, basename='show')
router.register(r'epg', views.EPGEntryViewSet, basename='epgentry')
router.register(r'codecs', views.CodecViewSet, basename='codec')
router.register(r'jingles', views.JingleViewSet, basename='jingle')
router.register(r'channel-zones', views.ChannelZoneViewSet, basename='channelzone')

# The API URLs are now determined automatically by the router
urlpatterns = [
    path('', include(router.urls)),
    
    # Custom API endpoints
    path('channels/<int:channel_id>/zones/', views.ChannelZonesAPIView.as_view(), name='channel-zones-api'),
    path('epg/calendar/', views.EPGCalendarAPIView.as_view(), name='epg-calendar-api'),
    path('channels/<int:channel_id>/epg/', views.ChannelEPGAPIView.as_view(), name='channel-epg-api'),
    path('zones/<int:zone_id>/channels/', views.ZoneChannelsAPIView.as_view(), name='zone-channels-api'),
    path('shows/<int:show_id>/epg/', views.ShowEPGAPIView.as_view(), name='show-epg-api'),
    path('channels/<int:channel_id>/jingles/', views.ChannelJinglesAPIView.as_view(), name='channel-jingles-api'),
    path('epg/conflicts/', views.EPGConflictsAPIView.as_view(), name='epg-conflicts-api'),
    path('channels/statistics/', views.ChannelStatisticsAPIView.as_view(), name='channel-statistics-api'),
    path('epg/upcoming/', views.UpcomingProgramsAPIView.as_view(), name='upcoming-programs-api'),
]

app_name = 'channels-api'