Add ability to schedule video publication
[oweals/peertube.git] / shared / models / videos / video.model.ts
1 import { VideoResolution, VideoState } from '../../index'
2 import { Account } from '../actors'
3 import { Avatar } from '../avatars/avatar.model'
4 import { VideoChannel } from './video-channel.model'
5 import { VideoPrivacy } from './video-privacy.enum'
6 import { VideoScheduleUpdate } from './video-schedule-update.model'
7
8 export interface VideoConstant <T> {
9   id: T
10   label: string
11 }
12
13 export interface VideoFile {
14   magnetUri: string
15   resolution: VideoConstant<VideoResolution>
16   size: number // Bytes
17   torrentUrl: string
18   torrentDownloadUrl: string
19   fileUrl: string
20   fileDownloadUrl: string
21 }
22
23 export interface Video {
24   id: number
25   uuid: string
26   createdAt: Date | string
27   updatedAt: Date | string
28   publishedAt: Date | string
29   category: VideoConstant<number>
30   licence: VideoConstant<number>
31   language: VideoConstant<string>
32   privacy: VideoConstant<VideoPrivacy>
33   description: string
34   duration: number
35   isLocal: boolean
36   name: string
37   thumbnailPath: string
38   previewPath: string
39   embedPath: string
40   views: number
41   likes: number
42   dislikes: number
43   nsfw: boolean
44
45   waitTranscoding?: boolean
46   state?: VideoConstant<VideoState>
47   scheduledUpdate?: VideoScheduleUpdate
48
49   account: {
50     id: number
51     uuid: string
52     name: string
53     displayName: string
54     url: string
55     host: string
56     avatar: Avatar
57   }
58
59   channel: {
60     id: number
61     uuid: string
62     name: string
63     displayName: string
64     url: string
65     host: string
66     avatar: Avatar
67   }
68 }
69
70 export interface VideoDetails extends Video {
71   descriptionPath: string
72   support: string
73   channel: VideoChannel
74   tags: string[]
75   files: VideoFile[]
76   account: Account
77   commentsEnabled: boolean
78
79   // Not optional in details (unlike in Video)
80   waitTranscoding: boolean
81   state: VideoConstant<VideoState>
82 }