1 import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2 import { PickWith } from '../../utils'
3 import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4 import { MThumbnail } from './thumbnail'
5 import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
6 import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
8 type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
10 // ############################################################################
12 export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
14 // ############################################################################
16 export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
17 export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
18 export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
19 export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
21 // ############################################################################
25 export type MVideoPlaylistWithElements = MVideoPlaylist &
26 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
28 export type MVideoPlaylistIdWithElements = MVideoPlaylistId &
29 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
31 // ############################################################################
35 export type MVideoPlaylistOwner = MVideoPlaylist &
36 Use<'OwnerAccount', MAccount>
38 export type MVideoPlaylistOwnerDefault = MVideoPlaylist &
39 Use<'OwnerAccount', MAccountDefault>
41 // ############################################################################
45 export type MVideoPlaylistThumbnail = MVideoPlaylist &
46 Use<'Thumbnail', MThumbnail>
48 export type MVideoPlaylistAccountThumbnail = MVideoPlaylist &
49 Use<'OwnerAccount', MAccountDefault> &
50 Use<'Thumbnail', MThumbnail>
52 // ############################################################################
56 export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist &
57 Use<'OwnerAccount', MAccountDefault> &
58 Use<'VideoChannel', MChannelDefault>
60 // ############################################################################
62 // With all associations
64 export type MVideoPlaylistFull = MVideoPlaylist &
65 Use<'OwnerAccount', MAccountDefault> &
66 Use<'VideoChannel', MChannelDefault> &
67 Use<'Thumbnail', MThumbnail>
69 // ############################################################################
73 export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist &
74 Use<'OwnerAccount', MAccountSummary> &
75 Use<'VideoChannel', MChannelSummary>
77 export type MVideoPlaylistFullSummary = MVideoPlaylist &
78 Use<'Thumbnail', MThumbnail> &
79 Use<'OwnerAccount', MAccountSummary> &
80 Use<'VideoChannel', MChannelSummary>
82 // ############################################################################
84 // Format for API or AP object
86 export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength &
87 Use<'OwnerAccount', MAccountSummaryFormattable> &
88 Use<'VideoChannel', MChannelSummaryFormattable>
90 export type MVideoPlaylistAP = MVideoPlaylist &
91 Use<'Thumbnail', MThumbnail> &
92 Use<'VideoChannel', MChannelUrl>