use super::{BuildIdentity, IssuePaths};
#[derive(Debug, Clone)]
pub struct IssueDiagnostics {
identity: BuildIdentity,
active_board: Option<String>,
theme_id: Option<String>,
icon_size: Option<String>,
paths: Option<IssuePaths>,
}
impl From<BuildIdentity> for IssueDiagnostics {
fn from(identity: BuildIdentity) -> Self {
Self {
identity,
active_board: None,
theme_id: None,
icon_size: None,
paths: None,
}
}
}
impl IssueDiagnostics {
pub fn new(product_id: impl Into<String>, app_version: impl Into<String>) -> Self {
BuildIdentity::new(product_id, app_version).into()
}
pub fn with_build(mut self, channel: impl Into<String>, commit: impl Into<String>) -> Self {
self.identity = self.identity.with_build(channel, commit);
self
}
pub fn with_platform(mut self, os: impl Into<String>, architecture: impl Into<String>) -> Self {
self.identity = self.identity.with_platform(os, architecture);
self
}
pub fn with_active_board(mut self, id: impl Into<String>) -> Self {
self.active_board = Some(id.into());
self
}
pub fn with_appearance(
mut self,
theme_id: impl Into<String>,
icon_size: impl Into<String>,
) -> Self {
self.theme_id = Some(theme_id.into());
self.icon_size = Some(icon_size.into());
self
}
pub fn with_paths(mut self, paths: IssuePaths) -> Self {
self.paths = Some(paths);
self
}
pub fn without_paths(mut self) -> Self {
self.paths = None;
self
}
pub fn paths(&self) -> Option<&IssuePaths> {
self.paths.as_ref()
}
pub fn product_id(&self) -> &str {
self.identity.product_id()
}
pub fn app_version(&self) -> &str {
self.identity.app_version()
}
pub fn channel(&self) -> Option<&str> {
self.identity.channel()
}
pub fn commit(&self) -> Option<&str> {
self.identity.commit()
}
pub fn os(&self) -> Option<&str> {
self.identity.os()
}
pub fn architecture(&self) -> Option<&str> {
self.identity.architecture()
}
pub fn active_board(&self) -> Option<&str> {
self.active_board.as_deref()
}
pub fn theme_id(&self) -> Option<&str> {
self.theme_id.as_deref()
}
pub fn icon_size(&self) -> Option<&str> {
self.icon_size.as_deref()
}
}