use serde::Deserialize;

#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCodes {
	pub codes: Vec<ProCode>,
}

#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCode {
	pub name: String,
	pub stars: u8,
}

impl ProCode {
	pub fn id(&self) -> String {
		self.name.replace(" ", "_").to_lowercase()
	}
}

#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCodeFights {
	pub fights: Vec<ProCodeFight>,
}

#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCodeFight {
	pub world: String,
	pub enemy: String,
	pub merit: u16,
}

impl ProCodeFight {
	pub fn source(&self) -> String {
		let world = self.world.replace(" ", "_").to_lowercase();
		let enemy = self.enemy.replace(" ", "_").to_lowercase();
		format!("{world}/{enemy}")
	}
}
