File size: 1,567 Bytes
2156b71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5beeefc
 
 
51913a2
5beeefc
 
 
 
 
 
2156b71
 
 
 
 
 
 
5beeefc
 
 
 
 
a8673cc
 
 
 
 
2156b71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(rename_all = "lowercase")]
pub enum UserTier {
    #[default]
    Free,
    Pro,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VideoTask {
    pub video_id: String,
    pub task_id: String,
    pub target_format: String, // "home" or "flash"
    pub tier: UserTier,
    #[serde(default)]
    pub skip_thumbnail: bool,
    /// "auto" (Rust generates) or "custom" (client already uploaded cover)
    #[serde(default = "default_cover_source", alias = "coverSource")]
    pub cover_source: String,
    /// S3 key for a custom cover, e.g. thumbnails/{job_id}.jpg
    #[serde(default, alias = "coverS3Key")]
    pub cover_s3_key: Option<String>,
}

fn default_cover_source() -> String {
    "auto".to_string()
}

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TaskStatus {
    pub progress: u32,
    pub status: String,
    pub message: String,
    /// Public or storage-relative cover URL/key after processing
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub cover_url: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub cover_source: Option<String>,
    /// Variant playlist names actually produced, e.g. ["720p"] or
    /// ["1080p", "720p", "480p"]. The backend wires per-resolution URLs from
    /// this so it never advertises a rendition that was not generated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variants: Option<Vec<String>>,
}