pub use self::bias::{Settings as BiasSettings};
pub use self::blinking::{Settings as BlinkingSettings};
pub use self::ratio::{Settings as RatioSettings};
pub use self::squirrel::{Settings as SquirrelSettings};

mod bias;
mod blinking;
mod squirrel;
mod ratio;

#[derive(Debug, Clone, PartialEq)]
pub struct Settings
{
	ratio: RatioSettings,
	magnification: RatioSettings,
	drift_difference_within: f64,
	sampling_threshold: f64,
	blinking: BlinkingSettings,
	bias: BiasSettings,
	squirrel: SquirrelSettings,
}

impl Settings
{
	pub fn ratio(&self) -> &RatioSettings
	{
		&self.ratio
	}

	pub fn with_ratio(mut self, value: RatioSettings) -> Self
	{
		self.ratio = value;
		self
	}

	pub fn magnification(&self) -> &RatioSettings
	{
		&self.magnification
	}

	pub fn with_magnification(mut self, value: RatioSettings) -> Self
	{
		self.magnification = value;
		self
	}

	pub fn drift_difference_within(&self) -> f64
	{
		self.drift_difference_within
	}

	pub fn with_drift_difference_within(mut self, value: f64) -> Self
	{
		self.drift_difference_within = value;
		self
	}

	pub fn sampling_threshold(&self) -> f64
	{
		self.sampling_threshold
	}

	pub fn with_sampling_threshold(mut self, value: f64) -> Self
	{
		self.sampling_threshold = value;
		self
	}
	
	pub fn blinking(&self) -> &BlinkingSettings
	{
		&self.blinking
	}

	pub fn with_blinking_settings(mut self, value: BlinkingSettings) -> Self
	{
		self.blinking = value;
		self
	}

	pub fn bias(&self) -> &BiasSettings
	{
		&self.bias
	}

	pub fn with_bias(mut self, value: BiasSettings) -> Self
	{
		self.bias = value;
		self
	}

	pub fn squirrel(&self) -> &SquirrelSettings
	{
		&self.squirrel
	}

	pub fn with_squirrel(mut self, value: SquirrelSettings) -> Self
	{
		self.squirrel = value;
		self
	}
}

impl Default for Settings
{
	fn default() -> Self 
	{
		Settings 
		{
		 	ratio: RatioSettings::default(),
		 	sampling_threshold: 0.1,
			blinking: BlinkingSettings::default(),
			drift_difference_within: 0.1,
			magnification: RatioSettings::magnification(),
			bias: BiasSettings::default(),
			squirrel: SquirrelSettings::default(),
		}
	}
}