Skip to main content

mangofetch_core/models/
download.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::path::PathBuf;
4use uuid::Uuid;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct DownloadTask {
8    pub id: Uuid,
9    pub url: String,
10    pub title: String,
11    pub platform: String,
12    pub status: DownloadStatus,
13    pub output_dir: PathBuf,
14    pub created_at: DateTime<Utc>,
15    pub updated_at: DateTime<Utc>,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
19pub enum DownloadStatus {
20    Queued,
21    Downloading,
22    Paused,
23    Completed,
24    Failed,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct DownloadProgress {
29    pub task_id: Uuid,
30    pub percent: f64,
31    pub speed_bps: u64,
32}