use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PatchEntry {
pub hash: String,
pub subject: String,
pub body: String,
pub author: String,
pub timestamp: String,
pub pr_branch: Option<String>,
pub pr_number: Option<u32>,
pub pr_url: Option<String>,
pub status: PatchStatus,
}
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub enum PatchStatus {
#[default]
Clean,
Conflict,
Editing,
Submitted,
Merged,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Stack {
pub base: String,
pub patches: Vec<PatchEntry>,
}
impl Stack {
pub fn new(base: String, patches: Vec<PatchEntry>) -> Self {
Self { base, patches }
}
pub fn len(&self) -> usize {
self.patches.len()
}
pub fn is_empty(&self) -> bool {
self.patches.is_empty()
}
}