use crate::core::Chart;
use crate::features::{
domains::Domain, mutagen_flows::MutagenFlow, palace_features::PalaceFeature,
relations::PalaceRelation, star_features::StarFeature,
};
use serde::{Deserialize, Serialize};
use thiserror::Error;
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct ChartFeatures {
source_profile_id: String,
domains: Vec<Domain>,
palace_features: Vec<PalaceFeature>,
star_features: Vec<StarFeature>,
mutagen_flows: Vec<MutagenFlow>,
relations: Vec<PalaceRelation>,
}
impl ChartFeatures {
pub fn new(
source_profile_id: impl Into<String>,
domains: Vec<Domain>,
palace_features: Vec<PalaceFeature>,
star_features: Vec<StarFeature>,
mutagen_flows: Vec<MutagenFlow>,
relations: Vec<PalaceRelation>,
) -> Self {
Self {
source_profile_id: source_profile_id.into(),
domains,
palace_features,
star_features,
mutagen_flows,
relations,
}
}
pub fn empty(source_profile_id: impl Into<String>) -> Self {
Self::new(
source_profile_id,
Vec::new(),
Vec::new(),
Vec::new(),
Vec::new(),
Vec::new(),
)
}
pub fn source_profile_id(&self) -> &str {
&self.source_profile_id
}
pub fn domains(&self) -> &[Domain] {
&self.domains
}
pub fn palace_features(&self) -> &[PalaceFeature] {
&self.palace_features
}
pub fn star_features(&self) -> &[StarFeature] {
&self.star_features
}
pub fn mutagen_flows(&self) -> &[MutagenFlow] {
&self.mutagen_flows
}
pub fn relations(&self) -> &[PalaceRelation] {
&self.relations
}
}
pub trait FeatureExtractor {
fn extract(&self, chart: &Chart) -> Result<ChartFeatures, FeatureExtractionError>;
}
#[derive(Debug, Error, Eq, PartialEq)]
pub enum FeatureExtractionError {
#[error("feature extraction is not implemented")]
NotImplemented,
}