1 import { VideoCommentModel } from '../../../models/video/video-comment'
2 import { PickWith, PickWithOpt } from '../../utils'
3 import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4 import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
6 type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
8 // ############################################################################
10 export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
11 export type MCommentTotalReplies = MComment & { totalReplies?: number }
12 export type MCommentId = Pick<MComment, 'id'>
13 export type MCommentUrl = Pick<MComment, 'url'>
15 // ############################################################################
17 export type MCommentOwner =
19 Use<'Account', MAccountDefault>
21 export type MCommentVideo =
23 Use<'Video', MVideoAccountLight>
25 export type MCommentReply =
27 Use<'InReplyToVideoComment', MComment>
29 export type MCommentOwnerVideo =
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight>
34 export type MCommentOwnerVideoReply =
36 Use<'Account', MAccountDefault> &
37 Use<'Video', MVideoAccountLight> &
38 Use<'InReplyToVideoComment', MComment>
40 export type MCommentOwnerReplyVideoLight =
42 Use<'Account', MAccountDefault> &
43 Use<'InReplyToVideoComment', MComment> &
44 Use<'Video', MVideoIdUrl>
46 export type MCommentOwnerVideoFeed =
48 Use<'Video', MVideoFeed>
50 // ############################################################################
52 export type MCommentAPI = MComment & { totalReplies: number }
54 // ############################################################################
56 // Format for API or AP object
58 export type MCommentFormattable =
59 MCommentTotalReplies &
60 Use<'Account', MAccountFormattable>
62 export type MCommentAP =
64 Use<'Account', MAccountUrl> &
65 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
66 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>