use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RepoInfo {
pub owner: String,
pub repo: String,
}
#[derive(Debug, Clone, Deserialize)]
pub struct PullRequest {
pub number: u64,
pub html_url: String,
pub title: String,
pub body: Option<String>,
pub base: PullRequestRef,
pub head: PullRequestRef,
#[serde(default)]
pub draft: bool,
#[serde(default)]
pub node_id: String,
#[serde(default)]
pub merged_at: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct PullRequestRef {
#[serde(rename = "ref")]
pub ref_name: String,
#[serde(default)]
pub label: String,
}
#[derive(Debug, Clone, Deserialize)]
pub struct IssueComment {
pub id: u64,
pub body: Option<String>,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, clap::ValueEnum)]
#[serde(rename_all = "lowercase")]
pub enum MergeMethod {
#[default]
Squash,
Merge,
Rebase,
}
impl std::fmt::Display for MergeMethod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Squash => write!(f, "squash"),
Self::Merge => write!(f, "merge"),
Self::Rebase => write!(f, "rebase"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ChecksStatus {
Pass,
Pending,
Fail,
None,
}
#[derive(Debug, Clone)]
pub struct ReviewSummary {
pub approved_count: u32,
pub changes_requested: bool,
}
#[derive(Debug, Clone)]
pub struct PrState {
pub merged: bool,
pub state: String,
}
#[derive(Debug, Clone)]
pub struct PrMergeability {
pub mergeable: Option<bool>,
pub mergeable_state: String,
}