/*
	This shows...

*/



/*
	use crate::_furniture::likelihood::{ likelihood };
	likelihood ("Flop", 1, 10);
*/

use serde::{ Deserialize, Serialize };
use serde_json::Result;

fn round_to_two_decimal_places (float_1 : f64) -> String {
	format! ("{:.2}", float_1)
}


pub struct Proceeds {
    pub every__f64: f64,
    pub every__string: String,
}

pub fn likelihood (
	name : &str, 
	has : i64, 
	realities : i64
) -> Proceeds {

	
	/*
		For Example:
			Pocket 1/17 -> 17
	
	
		* found_realities (splits)
	*/
	let found_realities_f64 : f64 = 1 as f64 / (has as f64 / realities as f64);
	let found_realities_string : String = round_to_two_decimal_places (found_realities_f64);
	
	/*
	
	
	*/
	let percent_f64 : f64 = (has as f64 / realities as f64) * 100 as f64;
	let percent_string : String = round_to_two_decimal_places (percent_f64);
	
	/*
		Example:
			has/realities = 1/10 = 1:9
			(realities/has)/has = (10-1)/1 = 9
	
		let ratio : String = round_to_two_decimal_places ()
	*/
	let ratio_string : String = round_to_two_decimal_places (0 as f64);
	let odds_2_f64 : f64 = (realities as f64 - has as f64) / has as f64;
	let odds_2_string : String = round_to_two_decimal_places (odds_2_f64);

	
	/*
		Found:Didn't Find
		Win:Loss
		Victory:Defeat
	*/
	#[derive(Serialize, Deserialize)]
	struct Show_Results {
		every__f64 : f64,
		every__string : String,
		VD_odds: String,
		percent: String,
		fraction_unreduced: String
	};
	
	let show_results = Show_Results {
		every__f64: found_realities_f64,
		// every__string: format! ("1 every {}", found_realities_string),
		every__string: format! ("{}", found_realities_string),
		
		VD_odds: format! ("1 : {}", odds_2_string),
		percent: format! ("{}%", percent_string),
		fraction_unreduced : format! ("{} / {}", has, realities)
	};
	
	let results_hull = serde_json::to_string_pretty (&show_results).unwrap ();
	println! ("{}: {}", name, results_hull);
	
	Proceeds {
		every__f64: found_realities_f64,
		every__string: found_realities_string,
	}
		
	/*
	return (
		found_realities_f64, 
		found_realities_string 
	)
	*/
}