1 import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
2 import { VideoChannelModel } from '../../../models/video/video-channel'
10 MAccountSummaryFormattable,
14 MActorAccountChannelId,
22 MActorSummaryFormattable, MActorUrl
24 import { MVideo } from './video'
26 type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
28 // ############################################################################
30 export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
32 // ############################################################################
34 export type MChannelId = Pick<MChannel, 'id'>
36 // ############################################################################
38 export type MChannelIdActor =
40 Use<'Actor', MActorAccountChannelId>
42 export type MChannelUserId =
43 Pick<MChannel, 'accountId'> &
44 Use<'Account', MAccountUserId>
46 export type MChannelActor =
50 export type MChannelUrl = Use<'Actor', MActorUrl>
53 export type MChannelDefault =
55 Use<'Actor', MActorDefault>
57 // ############################################################################
59 // Not all association attributes
61 export type MChannelLight =
63 Use<'Actor', MActorDefaultLight>
65 export type MChannelActorLight =
67 Use<'Actor', MActorLight>
69 export type MChannelAccountLight =
71 Use<'Actor', MActorDefaultLight> &
72 Use<'Account', MAccountLight>
74 // ############################################################################
76 // Account associations
78 export type MChannelAccountActor =
80 Use<'Account', MAccountActor>
82 export type MChannelAccountDefault =
84 Use<'Actor', MActorDefault> &
85 Use<'Account', MAccountDefault>
87 export type MChannelActorAccountActor =
89 Use<'Account', MAccountActor> &
92 // ############################################################################
94 // Videos associations
95 export type MChannelVideos =
97 Use<'Videos', MVideo[]>
99 export type MChannelActorAccountDefaultVideos =
101 Use<'Actor', MActorDefault> &
102 Use<'Account', MAccountDefault> &
103 Use<'Videos', MVideo[]>
105 // ############################################################################
109 export type MChannelSummary =
110 FunctionProperties<MChannel> &
111 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
112 Use<'Actor', MActorSummary>
114 export type MChannelSummaryAccount =
116 Use<'Account', MAccountSummaryBlocks>
118 export type MChannelAPI =
120 Use<'Actor', MActorAPI> &
121 Use<'Account', MAccountAPI>
123 // ############################################################################
125 // Format for API or AP object
127 export type MChannelSummaryFormattable =
128 FunctionProperties<MChannel> &
129 Pick<MChannel, 'id' | 'name'> &
130 Use<'Actor', MActorSummaryFormattable>
132 export type MChannelAccountSummaryFormattable =
133 MChannelSummaryFormattable &
134 Use<'Account', MAccountSummaryFormattable>
136 export type MChannelFormattable =
137 FunctionProperties<MChannel> &
138 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
139 Use<'Actor', MActorFormattable> &
140 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
142 export type MChannelAP =
143 Pick<MChannel, 'name' | 'description' | 'support'> &
144 Use<'Actor', MActorAP> &
145 Use<'Account', MAccountUrl>