use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct Bookmark {
pub name: String,
pub commit_id: String,
pub change_id: String,
pub has_remote: bool,
pub is_synced: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LogEntry {
pub commit_id: String,
pub change_id: String,
pub author_name: String,
pub author_email: String,
pub description_first_line: String,
pub parents: Vec<String>,
pub local_bookmarks: Vec<String>,
pub remote_bookmarks: Vec<String>,
pub is_working_copy: bool,
pub authored_at: DateTime<Utc>,
pub committed_at: DateTime<Utc>,
}
#[derive(Debug, Clone)]
pub struct BookmarkSegment {
pub bookmarks: Vec<Bookmark>,
pub changes: Vec<LogEntry>,
}
#[derive(Debug, Clone)]
pub struct NarrowedBookmarkSegment {
pub bookmark: Bookmark,
pub changes: Vec<LogEntry>,
}
#[derive(Debug, Clone)]
pub struct BranchStack {
pub segments: Vec<BookmarkSegment>,
}
#[derive(Debug, Clone, Default)]
pub struct ChangeGraph {
pub bookmarks: HashMap<String, Bookmark>,
pub stack: Option<BranchStack>,
pub excluded_bookmark_count: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PullRequest {
pub number: u64,
pub html_url: String,
pub base_ref: String,
pub head_ref: String,
pub title: String,
pub node_id: Option<String>,
pub is_draft: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PrComment {
pub id: u64,
pub body: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GitRemote {
pub name: String,
pub url: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Platform {
GitHub,
GitLab,
}
impl std::fmt::Display for Platform {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::GitHub => write!(f, "GitHub"),
Self::GitLab => write!(f, "GitLab"),
}
}
}
#[derive(Debug, Clone)]
pub struct PlatformConfig {
pub platform: Platform,
pub owner: String,
pub repo: String,
pub host: Option<String>,
}