using LeafWeb.Core.Utility;

namespace LeafWeb.Core.Entities
{
	/// <summary>
	/// First model prediction is calculated at each sampling point.
	/// Then model prediction is calculated at many selected levels of intercelluar CO2 partial pressure 
	/// levels under three limitation states to enable plotting curves.The same structure is then repeated for 
	/// each fitting of the same curve with different parameters to be estimated and with different curves. Note 
	/// that some common information about a curve is repeated for each data point to make the structure of the 
	/// file as regular as possible.
	/// </summary>
	public class LeafGasComparisonFittingInfo
	{
		/// <summary>
		/// the curve identifier, repeated for each point
		/// </summary>
		[ParseInfo(1)]
		public string CurveID { get; set; }
		
		/// <summary>
		/// whether or not the internal conductance (gi) is fitted for.  
		/// 0 = not fitted and gi is either infinite or fixed at the value provided by the user. 
		/// 1 = gi is estiamted, repeated for each point
		/// </summary>
		[ParseInfo(2, boolEncodedPosition: 1, alternateTitle: "FitRwp|Rch|ha?")] // formerly FitGi
		public bool FitRwp {get; set;}
		
		/// <summary>
		/// TODO? : boolEncodedPosition only able to parse a single value from each cell currently
		/// </summary>
		//[ParseInfo(2, boolEncodedPosition: 2, alternateTitle: "FitRwp|Rch|ha?")] // formerly FitGi
		//public bool FitRch {get; set;}

		/// <summary>
		/// whether or not the chloroplastic CO2 partial pressure photocompensation point is 
		/// fitted for. 0= not fitted, a prescribed value is used, repeated for each point
		/// </summary>
		[ParseInfo(4, boolEncodedPosition: 1, alternateTitle: "FitGamma*?")]
		public bool FitGammaStar {get; set; }
		
		/// <summary>
		/// intercellular CO2 partial pressure
		/// </summary>
		[ParseInfo(10, units:"Pa")]
		public double CO2i_obs { get; set; }

		/// <summary>
		/// chloroplastic CO2 partial pressure corresponding to the PCO2i of a point.  
		/// PCO2c=PCO2i-AnetCal/internal conductance
		/// </summary>
		[ParseInfo(12, units:"Pa")]
		public double CO2c { get; set; }

		/// <summary>
		/// measured net assimilation rate
		/// </summary>
		[ParseInfo(13, units: "umol/m2/s")]
		public double Anet_obs { get; set; }
		
		/// <summary>
		/// 1 = point limited by rubisco 
		/// 2 = point limited by RuBP regeneration
		/// 3 = point limited by TPU
		/// </summary>
		[ParseInfo(15, units:"1,2,3")]
		public int LimitState { get; set; }

		public virtual LeafGasComparison LeafGasComparison { get; set; }
	}
}