0ffd0c30222ffd1dde5bc28e951bfd2f15966d80
[oweals/peertube.git] / server / typings / models / video / video.ts
1 import { VideoModel } from '../../../models/video/video'
2 import { PickWith, PickWithOpt } from '../../utils'
3 import { MChannelAccountLight, MChannelActor, MChannelActorAccountDefault, MChannelUserId } from './video-channels'
4 import { MTag } from './tag'
5 import { MVideoCaptionLanguage } from './video-caption'
6 import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist'
7 import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
8 import { MThumbnail } from './thumbnail'
9 import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
10 import { MScheduleVideoUpdate } from './schedule-video-update'
11 import { MUserVideoHistoryTime } from '../user/user-video-history'
12
13 export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
14   'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
15   'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
16
17 export type MVideoId = Pick<MVideo, 'id'>
18 export type MVideoUrl = Pick<MVideo, 'url'>
19 export type MVideoUUID = Pick<MVideo, 'uuid'>
20
21 export type MVideoIdUrl = MVideoId & MVideoUrl
22 export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
23
24 export type MVideoWithFile = MVideo &
25   PickWith<VideoModel, 'VideoFiles', MVideoFile[]>
26
27 export type MVideoThumbnail = MVideo &
28   PickWith<VideoModel, 'Thumbnails', MThumbnail[]>
29 export type MVideoIdThumbnail = MVideoThumbnail & MVideoId
30
31 export type MVideoTag = MVideo &
32   PickWith<VideoModel, 'Tags', MTag[]>
33
34 export type MVideoWithSchedule = MVideo &
35   PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
36
37 export type MVideoWithFileThumbnail = MVideoWithFile & MVideoThumbnail
38
39 export type MVideoUser = MVideo &
40   PickWith<VideoModel, 'VideoChannel', MChannelUserId>
41
42 export type MVideoWithCaptions = MVideo &
43   PickWith<VideoModel, 'VideoCaptions', MVideoCaptionLanguage[]>
44
45 export type MVideoWithBlacklistLight = MVideo &
46   PickWith<VideoModel, 'VideoBlacklist', MVideoBlacklistLight>
47
48 export type MVideoAccountLight = MVideo &
49   PickWith<VideoModel, 'VideoChannel', MChannelAccountLight>
50
51 export type MVideoWithRights = MVideoWithBlacklistLight & MVideoThumbnail & MVideoUser
52
53 export type MVideoWithStreamingPlaylist = MVideo &
54   PickWith<VideoModel, 'VideoStreamingPlaylists', MStreamingPlaylist[]>
55
56 export type MVideoWithAllFiles = MVideoWithFileThumbnail & MVideoWithStreamingPlaylist
57
58 export type MVideoAccountAllFiles = MVideoWithAllFiles & MVideoAccountLight & MVideoWithBlacklistLight
59 export type MVideoAccountAllFilesCaptions = MVideoAccountAllFiles & MVideoWithCaptions
60
61 export type MVideoUserHistory = MVideo &
62   PickWith<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]>
63
64 export type MVideoWithBlacklistThumbnailScheduled = MVideoWithSchedule & MVideoWithBlacklistLight & MVideoWithFileThumbnail
65
66 export type MVideoAccountDefault = MVideo &
67   PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault>
68
69 export type MVideoThumbnailAccountDefault = MVideoThumbnail &
70   PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault>
71
72 export type MVideoWithChannelActor = MVideo &
73   PickWith<VideoModel, 'VideoChannel', MChannelActor>
74
75 export type MVideoFullLight = MVideoThumbnail &
76   MVideoWithBlacklistLight &
77   MVideoTag &
78   MVideoAccountLight &
79   MVideoUserHistory &
80   MVideoWithFile &
81   MVideoWithSchedule &
82   MVideoWithStreamingPlaylist &
83   MVideoUserHistory
84
85 export type MVideoAP = MVideo &
86   MVideoTag &
87   MVideoAccountLight &
88   MVideoWithStreamingPlaylist &
89   MVideoWithCaptions &
90   PickWith<VideoModel, 'VideoBlacklist', MVideoBlacklistUnfederated> &
91   PickWith<VideoModel, 'VideoFiles', MVideoFileRedundanciesOpt[]>
92
93 export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
94
95 export type MVideoDetails = MVideo &
96   MVideoWithBlacklistLight &
97   MVideoTag &
98   MVideoAccountLight &
99   MVideoWithSchedule &
100   MVideoThumbnail &
101   MVideoUserHistory &
102   PickWith<VideoModel, 'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
103   PickWith<VideoModel, 'VideoFiles', MVideoFileRedundanciesOpt[]>