4e5c2e4f0ae2635e6b0c93a821788817ed6a4c37
[oweals/peertube.git] / server / typings / models / video / video-import.ts
1 import { VideoImportModel } from '@server/models/video/video-import'
2 import { PickWith, PickWithOpt } from '@server/typings/utils'
3 import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
4 import { MUser } from '../user/user'
5
6 type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
7
8 // ############################################################################
9
10 export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
11
12 export type MVideoImportVideo =
13   MVideoImport &
14   Use<'Video', MVideo>
15
16 // ############################################################################
17
18 type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
19
20 export type MVideoImportDefault =
21   MVideoImport &
22   Use<'User', MUser> &
23   Use<'Video', VideoAssociation>
24
25 export type MVideoImportDefaultFiles =
26   MVideoImport &
27   Use<'User', MUser> &
28   Use<'Video', VideoAssociation & MVideoWithFile>
29
30 // ############################################################################
31
32 // Format for API or AP object
33
34 export type MVideoImportFormattable =
35   MVideoImport &
36   PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>