use askama::Template;

use crate::{
	RuntimeModule,
	common::{Game, drops::Drops, enemy::Enemy, synthesis::Synthesis},
	create_file,
};

const ENEMIES_PATH: &str = "./input/kh1/enemies";
const SYNTHESIS_PATH: &str = "./input/kh1/synthesis.toml";

#[derive(Template)]
#[template(path = "pages/kh1/drops.html")]
struct DropsTemplate {
	pub data: Drops,
}

#[derive(Template)]
#[template(path = "pages/kh1/synth.html")]
struct SynthTemplate {
	pub data: Synthesis,
}

pub struct Module;

impl RuntimeModule for Module {
	fn start_module() {
		tracing::info!("Loading KH1 synthesis data from {}", SYNTHESIS_PATH);
		let synth = Synthesis::new(SYNTHESIS_PATH);

		tracing::info!("Generating KH1 synth template");
		let synth_template = SynthTemplate { data: synth };

		create_file("./out/kh1", "synth", synth_template).unwrap();
	}
}
