1 import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2 import { PickWith, PickWithOpt } from '../../utils'
3 import { MVideoRedundancyFileUrl, MVideoRedundancy } 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 =
15 Use<'VideoFiles', MVideoFile[]>
17 export type MStreamingPlaylistVideo =
21 export type MStreamingPlaylistFilesVideo =
23 Use<'VideoFiles', MVideoFile[]> &
26 export type MStreamingPlaylistRedundanciesAll =
28 Use<'VideoFiles', MVideoFile[]> &
29 Use<'RedundancyVideos', MVideoRedundancy[]>
31 export type MStreamingPlaylistRedundancies =
33 Use<'VideoFiles', MVideoFile[]> &
34 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
36 export type MStreamingPlaylistRedundanciesOpt =
38 Use<'VideoFiles', MVideoFile[]> &
39 PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
41 export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
42 return !!(value as MStreamingPlaylist).playlistUrl