1 import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
2 import { PickWith } from '@shared/typescript-utils'
3 import { VideoPlaylistModel } from '../../../models/video/video-playlist'
4 import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
5 import { MThumbnail } from './thumbnail'
6 import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
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 =
27 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
29 export type MVideoPlaylistIdWithElements =
31 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
33 // ############################################################################
37 export type MVideoPlaylistOwner =
39 Use<'OwnerAccount', MAccount>
41 export type MVideoPlaylistOwnerDefault =
43 Use<'OwnerAccount', MAccountDefault>
45 // ############################################################################
49 export type MVideoPlaylistThumbnail =
51 Use<'Thumbnail', MThumbnail>
53 export type MVideoPlaylistAccountThumbnail =
55 Use<'OwnerAccount', MAccountDefault> &
56 Use<'Thumbnail', MThumbnail>
58 // ############################################################################
62 export type MVideoPlaylistAccountChannelDefault =
64 Use<'OwnerAccount', MAccountDefault> &
65 Use<'VideoChannel', MChannelDefault>
67 // ############################################################################
69 // With all associations
71 export type MVideoPlaylistFull =
72 MVideoPlaylistVideosLength &
73 Use<'OwnerAccount', MAccountDefault> &
74 Use<'VideoChannel', MChannelDefault> &
75 Use<'Thumbnail', MThumbnail>
77 // ############################################################################
81 export type MVideoPlaylistAccountChannelSummary =
83 Use<'OwnerAccount', MAccountSummary> &
84 Use<'VideoChannel', MChannelSummary>
86 export type MVideoPlaylistFullSummary =
87 MVideoPlaylistVideosLength &
88 Use<'Thumbnail', MThumbnail> &
89 Use<'OwnerAccount', MAccountSummary> &
90 Use<'VideoChannel', MChannelSummary>
92 // ############################################################################
94 // Format for API or AP object
96 export type MVideoPlaylistFormattable =
97 MVideoPlaylistVideosLength &
98 Use<'OwnerAccount', MAccountSummaryFormattable> &
99 Use<'VideoChannel', MChannelSummaryFormattable>
101 export type MVideoPlaylistAP =
103 Use<'Thumbnail', MThumbnail> &
104 Use<'VideoChannel', MChannelUrl>