use crate::genetics::{Genetic, Transcriber};

use super::{coloration::Coloration, gender::Gender, species::Parts, stats::Stats};

#[derive(Default)]
pub struct Phenotype {
    pub gender: Gender,
    pub parts: Parts,
    pub stats: Stats,
    pub coloration: Coloration,
}

impl Phenotype {
    pub fn profile(&self) -> String {
        format!(
            "{}{}{}{}",
            self.gender.profile(),
            self.parts.profile(),
            self.stats.profile(),
            self.coloration.profile()
        )
    }
}

impl Genetic for Phenotype {
    fn transcribe(&mut self, t: Transcriber) {
        self.gender.transcribe(t.nest("gender"));
        self.parts.transcribe(t.nest("parts"));
        self.stats.transcribe(t.nest("stats"));
        self.coloration.transcribe(t.nest("coloration"));
    }
}
