// IPTV Provider Types export type ProviderType = 'm3u' | 'xtream'; export interface IPTVProvider { id: string; name: string; type: ProviderType; createdAt: string; lastSync?: string; // M3U specific playlistUrl?: string; // Xtream specific serverUrl?: string; username?: string; password?: string; // EPG URL (extracted from provider or manually set) epgUrl?: string; // Account info (from Xtream API) accountInfo?: XtreamAccountInfo; } // Xtream account information export interface XtreamAccountInfo { status: string; // 'Active', 'Expired', 'Banned', etc. expirationDate?: string; // ISO date string isTrial: boolean; maxConnections: number; activeConnections?: number; createdAt?: string; // Account creation date from provider serverTimezone?: string; } // Content Type export type ContentType = 'live' | 'movie' | 'series'; // Base Content Interface export interface BaseContent { id: string; name: string; // Original provider name (preserved for reference) streamUrl: string; logoUrl?: string; category?: string; providerId: string; type: ContentType; /** Order number from provider (higher = more recently added) */ added?: number; /** Content metadata tags (e.g., "dubbed", "subtitled") */ tags?: string[]; /** TMDb title (clean, standardized title) - used for display when available */ tmdbTitle?: string; } // Channel Types (Live TV) export interface Channel extends BaseContent { type: 'live'; tvgId?: string; // For EPG matching tvgName?: string; groupTitle?: string; } // Movie Types (VOD) export interface Movie extends BaseContent { type: 'movie'; year?: number; duration?: number; // in seconds description?: string; rating?: number; containerExtension?: string; // Original container format (e.g., 'mkv', 'mp4') coverUrl?: string; // Cover/poster image URL from provider } // Series Types (TV Shows) export interface Series extends BaseContent { type: 'series'; coverUrl?: string; description?: string; rating?: number; // Additional metadata from provider cast?: string; director?: string; genre?: string; releaseDate?: string; year?: number; // Series-specific: episodes are loaded separately } // Union type for all content export type Content = Channel | Movie | Series; // EPG Types export interface EPGProgram { id: string; channelId: string; title: string; description?: string; start: string; // ISO date end: string; // ISO date category?: string; image?: string; // Program image/thumbnail episode?: { season?: number; episode?: number; title?: string; }; } export interface EPGChannel { id: string; // EPG channel ID (from XMLTV) displayName: string; icon?: string; channelIds: string[]; // Maps to our Channel.id[] } export interface EPGSource { id: string; name: string; url: string; enabled: boolean; priority: number; // Lower = higher priority timezone?: string; // Default timezone lastFetch?: string; // ISO date lastError?: string; } export interface EPGCacheEntry { channelId: string; programs: EPGProgram[]; fetchedAt: string; // ISO date expiresAt: string; // ISO date (typically +24 hours) } // Xtream API Response Types export interface XtreamCategory { category_id: string; category_name: string; parent_id: number; } export interface XtreamChannel { num: number; name: string; stream_type: string; stream_id: number; stream_icon?: string; epg_channel_id?: string; category_id: string; } // Xtream VOD (Movie) Types export interface XtreamVOD { num: number; name: string; stream_type: string; stream_id: number; stream_icon?: string; category_id: string; container_extension?: string; rating?: string; rating_5based?: number; releaseDate?: string; duration?: string; description?: string; } // Xtream Series Types export interface XtreamSeries { num: number; name: string; series_id: number; cover?: string; plot?: string; cast?: string; director?: string; genre?: string; releaseDate?: string; rating?: string; rating_5based?: number; category_id: string; } // Xtream Series Info (for episodes) export interface XtreamSeriesInfo { info: { name: string; cover?: string; plot?: string; cast?: string; director?: string; genre?: string; releaseDate?: string; rating?: string; }; episodes: { id: string; title: string; container_extension: string; info: { plot?: string; duration?: string; movie_image?: string; releaseDate?: string; }; }[]; } export interface XtreamUserInfo { username: string; password: string; status: string; exp_date: string; is_trial: string; active_cons: string; max_connections: string; } export interface XtreamServerInfo { url: string; port: string; https_port: string; server_protocol: string; rtmp_port: string; timezone: string; } export interface XtreamAuthResponse { user_info: XtreamUserInfo; server_info: XtreamServerInfo; } // Watch Progress Types export type WatchContentType = 'movie' | 'series' | 'channel' | 'episode'; export interface WatchProgress { id: string; userId?: string; // Optional for local storage, required for cloud profileId?: string; // For per-profile tracking (null = legacy data) contentId: string; contentType: WatchContentType; episodeId?: string; // For series episodes seasonNumber?: number; episodeNumber?: number; progressSeconds: number; // Current position in seconds totalSeconds?: number; // Total duration in seconds progressPercentage: number; // 0-100 completed: boolean; lastWatchedAt: string; // ISO timestamp createdAt: string; updatedAt: string; } export interface WatchProgressInput { contentId: string; contentType: WatchContentType; episodeId?: string; seasonNumber?: number; episodeNumber?: number; progressSeconds: number; totalSeconds?: number; completed?: boolean; // Note: profileId is passed as a separate parameter to save functions, not in the input } // Collections Types export * from './collections';