use crate::error::Result;
use crate::platforms::circleci::models::CircleCIConfig;
use crate::platforms::gitea::models::GiteaWorkflow;
use crate::platforms::github::models::GitHubWorkflow;
use crate::platforms::gitlab::models::GitLabCI;
use crate::platforms::jenkins::models::JenkinsConfig;
pub trait ToGitHub {
fn to_github(&self) -> Result<GitHubWorkflow>;
}
pub trait ToGitea {
fn to_gitea(&self) -> Result<GiteaWorkflow>;
}
pub trait ToGitLab {
fn to_gitlab(&self) -> Result<GitLabCI>;
}
pub trait ToCircleCI {
fn to_circleci(&self) -> Result<CircleCIConfig>;
}
pub trait ToJenkins {
fn to_jenkins(&self) -> Result<JenkinsConfig>;
}
pub trait Detectable {
fn matches_github(&self, workflow: &GitHubWorkflow) -> bool;
fn matches_gitea(&self, workflow: &GiteaWorkflow) -> bool;
fn matches_gitlab(&self, config: &GitLabCI) -> bool;
fn matches_circleci(&self, config: &CircleCIConfig) -> bool;
fn matches_jenkins(&self, pipeline: &JenkinsConfig) -> bool;
}
pub trait PresetInfo {
fn name(&self) -> &str;
fn description(&self) -> &str;
}
pub trait Preset: Detectable + PresetInfo {}
impl<T: Detectable + PresetInfo> Preset for T {}