1 import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2 import { PickWith, PickWithOpt } from '@server/typings/utils'
3 import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo, MVideoUrl } from '@server/typings/models'
4 import { VideoStreamingPlaylist } from '../../../../shared/models/videos/video-streaming-playlist.model'
5 import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
6 import { VideoFile } from '../../../../shared/models/videos'
7 import { VideoFileModel } from '@server/models/video/video-file'
9 type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
11 // ############################################################################
13 export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
15 export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
17 // ############################################################################
19 export type MVideoRedundancyFile = MVideoRedundancy &
20 Use<'VideoFile', MVideoFile>
22 export type MVideoRedundancyFileVideo = MVideoRedundancy &
23 Use<'VideoFile', MVideoFileVideo>
25 export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
26 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
28 export type MVideoRedundancyVideo = MVideoRedundancy &
29 Use<'VideoFile', MVideoFileVideo> &
30 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
32 // ############################################################################
34 // Format for API or AP object
36 export type MVideoRedundancyAP = MVideoRedundancy &
37 PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
38 PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>