1 import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2 import { PickWith, PickWithOpt } from '../../utils'
3 import { MVideoRedundancyFileUrl } from './video-redundancy'
4 import { MVideo } from './video'
5 import { MVideoFile } from './video-file'
7 type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
9 // ############################################################################
11 export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
13 export type MStreamingPlaylistFiles = MStreamingPlaylist &
14 Use<'VideoFiles', MVideoFile[]>
16 export type MStreamingPlaylistVideo = MStreamingPlaylist &
19 export type MStreamingPlaylistFilesVideo = MStreamingPlaylist &
20 Use<'VideoFiles', MVideoFile[]> &
23 export type MStreamingPlaylistRedundancies = MStreamingPlaylist &
24 Use<'VideoFiles', MVideoFile[]> &
25 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
27 export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist &
28 Use<'VideoFiles', MVideoFile[]> &
29 PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
31 export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
32 return !!(value as MStreamingPlaylist).playlistUrl