|
| 1 | +use chrono::NaiveDateTime as DateTime; |
| 2 | +use serde_derive::{Deserialize, Serialize}; |
| 3 | + |
| 4 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 5 | +pub struct PacBuild { |
| 6 | + pub name: PackageId, |
| 7 | + pub last_updated: DateTime, |
| 8 | + pub repository: URL, |
| 9 | + pub maintainer: String, |
| 10 | + pub package_name: String, |
| 11 | + pub description: String, |
| 12 | + pub homepage: URL, |
| 13 | + pub repology_version: Version, |
| 14 | + pub repology: URL, |
| 15 | + pub install_state: InstallState, |
| 16 | + pub dependencies: Vec<PackageId>, |
| 17 | + pub optional_dependencies: Vec<PackageId>, |
| 18 | + pub license: String, |
| 19 | + pub url: URL, |
| 20 | + pub kind: Kind, |
| 21 | +} |
| 22 | + |
| 23 | +pub type Version = String; |
| 24 | +pub type PackageId = String; |
| 25 | +pub type URL = String; |
| 26 | +pub type Hash = String; |
| 27 | + |
| 28 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 29 | +pub enum InstallState { |
| 30 | + Direct(DateTime, Version), |
| 31 | + Indirect(DateTime, Version), |
| 32 | + None, |
| 33 | +} |
| 34 | + |
| 35 | +impl InstallState { |
| 36 | + pub fn is_installed(&self) -> bool { |
| 37 | + match self { |
| 38 | + Self::None => false, |
| 39 | + _ => true, |
| 40 | + } |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 45 | +pub enum Kind { |
| 46 | + AppImage(Hash), |
| 47 | + Binary(Hash), |
| 48 | + DebFile(Hash), |
| 49 | + GitBranch, |
| 50 | + GitRelease, |
| 51 | +} |
0 commit comments