U
    h%$                     @   s  d Z ddlmZ ddlmZmZmZ ddlmZ G dd deZ	edej
ejdd	ed
ej
ejdd	gZedejejdd	Zedejejdd	Zedejejdd	ZedejejdddddddgdZedejejdd	ZedejejdddddgdZedejejdd	Zedejejd d	Zed!ejejd"d	Zed#ejejd$d	Zed%ejejd&d	Zed'd(d)d*d+d,d-d.d/d0d1d2ed3d4d5d6d7d8d9d:d;d<d=d<d>	d2gZed?d@dAdBdCdDdEdFdGd2edHdIdJdKdLdMdNdOdPdQdRdGd2edSdTdUdVdWdXdYdZd[d\d]dGd2gZed^d_d`dadbdcdddeedfdgdhdidjdkdddegZedldmdndogdpgdqdrdeedsdtdudvdwdeedxdydzd{dwdeed|d}d~ddwdedZedddQddddeedddQdddedZ dS )z
OpenAPI Schema Configuration for Stream Processing API

This module configures the OpenAPI schema generation for comprehensive
API documentation using drf-spectacular.
    )
AutoSchema)extend_schemaOpenApiParameterOpenApiExample)OpenApiTypesc                       s,   e Zd ZdZ fddZ fddZ  ZS )StreamProcessorAutoSchemaz1Custom schema generator for stream processor API.c                    sP   t | jdrF| jj}|rFt| jdd}|rF|jjj }| d| S t 	 S )z(Generate operation ID for API endpoints.actionquerysetN_)
hasattrviewr   getattrmodel_metaobject_namelowersuperget_operation_id)selfr   
model_name	__class__ 0/var/www/html/StreamProcessor/src/core/schema.pyr      s    z*StreamProcessorAutoSchema.get_operation_idc                    s.   t | jdr$| jjjjj}| gS t  S )z(Generate tags for API endpoint grouping.r	   )	r   r   r	   r   r   verbose_name_pluraltitler   get_tags)r   r   r   r   r   r      s    
z"StreamProcessorAutoSchema.get_tags)__name__
__module____qualname____doc__r   r   __classcell__r   r   r   r   r      s   r   pagezPage number for pagination)nametypelocationdescription	page_sizez"Number of items per page (max 100)orderingz@Field to order results by. Prefix with "-" for descending order.searchzSearch term to filter results	is_activez Filter channels by active statusstatuszFilter sessions by statuspendingactive
processing	completedfailed	cancelled)r#   r$   r%   r&   enumchannelzFilter by channel IDzFilter notifications by statusz!Filter by notification channel IDtemplate_typezFilter by template type
event_typezFilter by event type	date_fromz*Filter results from this date (YYYY-MM-DD)date_toz(Filter results to this date (YYYY-MM-DD)zBasic ChannelzBasic streaming channelz(A simple streaming channel configurationzNews Channelznews-channelz$https://example.com/news/stream.m3u8zLive news streaming channelz/data/streams/news   
   )r#   slughls_urlr&   output_directorysegment_durationmax_segments)summaryr&   valuezHigh Quality ChannelzHigh quality streaming channelz.Channel with custom video/audio configurationszPremium Sportszpremium-sportsz"https://example.com/sports/hd.m3u8z&Premium sports channel with HD qualityz/data/streams/sports         )	r#   r:   r;   r&   r<   r=   r>   retry_attemptsretry_intervalzTelegram ChannelzTelegram notification channelz,Configuration for Telegram bot notificationszTelegram Alertstelegramz$123456789:ABCdefGHIjklMNOpqrsTUVwxyzz-1001234567890)	bot_tokenchat_id)r#   channel_typeconfigurationzEmail ChannelzEmail notification channelz*Configuration for SMTP email notificationszEmail Alertsemailzsmtp.gmail.comiK  zalerts@example.comZapp_passwordT)	smtp_host	smtp_portusernamepasswordZuse_tlszWebhook ChannelzWebhook notification channelz'Configuration for webhook notificationszWebhook Alertswebhookz'https://api.example.com/webhooks/alertsPOSTzBearer your-api-tokenzapplication/json)AuthorizationzContent-Type)urlmethodheaderszStream Started Templatez'Template for stream start notificationszStream Started Alertstream_startedzStream {{channel_name}} StartedzbThe stream {{channel_name}} has started successfully at {{start_time}}. Session ID: {{session_id}})r#   r4   subject_templateZbody_template)r?   r@   zAd Break Templatez#Template for ad break notificationszAd Break Detectedad_break_detectedzAd Break in {{channel_name}}zXAd break detected in {{channel_name}} at {{detection_time}}. Confidence: {{confidence}}%zValidation ErrorzInput validation failedzValidation failedzInvalid URL format.z2Segment duration must be between 1 and 60 seconds.)r;   r=   )errordetailszResource Not Foundz!Requested resource does not existzResource not foundz%Channel with ID 12345 does not exist.)rY   detailzPermission DeniedzInsufficient permissionszPermission deniedz2You do not have permission to perform this action.zRate LimitedzAPI rate limit exceededzRate limit exceededz8Request was throttled. Expected available in 60 seconds.)validation_error	not_foundpermission_deniedZrate_limitedzTask Startedz&Background task initiated successfullyzabc123-def456-ghi789z(Stream capture task started successfully)successtask_idmessagezOperation Completedz Operation completed successfully)r_   ra   )task_startedZoperation_completedN)!r    drf_spectacular.openapir   drf_spectacular.utilsr   r   r   drf_spectacular.typesr   r   INTQUERYPAGINATION_PARAMETERSSTRORDERING_PARAMETERSEARCH_PARAMETERBOOLCHANNEL_STATUS_PARAMETERSESSION_STATUS_PARAMETERUUIDCHANNEL_FILTER_PARAMETERZNOTIFICATION_STATUS_PARAMETERZNOTIFICATION_CHANNEL_PARAMETERZTEMPLATE_TYPE_PARAMETERZEVENT_TYPE_PARAMETERDATEZDATE_FROM_PARAMETERZDATE_TO_PARAMETERCHANNEL_EXAMPLESZNOTIFICATION_CHANNEL_EXAMPLESZNOTIFICATION_TEMPLATE_EXAMPLESERROR_EXAMPLESSUCCESS_EXAMPLESr   r   r   r   <module>   s  
	"2
(	